home *** CD-ROM | disk | FTP | other *** search
/ Your Choice 3 / Your Choice Software Collection 3.iso / prgmming / qb_tips / qbtips_t.doc < prev   
Text File  |  1994-06-06  |  91KB  |  3,003 lines

  1.  
  2.  
  3. Name:             QBTips_T.Doc                         Date:  5/94
  4.  
  5. Also See:         QBTips_A through QBTips_R
  6.  
  7.  
  8. Purpose:          To provide insights and source code to help BASIC
  9.                   programmers -- beginner through advanced.
  10.  
  11.                   Load this into your word processor or editor.  Then
  12.                   scan it for tidbits you think will be useful.  Just
  13.                   "cut & paste" sections you like to separate files,
  14.                   then run the code.
  15.  
  16.  
  17. Source:           Below you'll find messages captured from the FidoNet
  18.                   Quik_Bas echo.  We captured CODE and significant tips,
  19.                   and eliminated chatter.
  20.  
  21.  
  22. Format:           Varies, depending on the author, their programming
  23.                   style, and the question or topic.
  24.  
  25.                   A form-feed (Chr$(12)) appears after most messages.
  26.                   This allows you to print this, and have each message
  27.                   (ie., each topic) start on a new page.
  28.  
  29.  
  30. Recommendation:   None!
  31.  
  32.                   Some of what you'll see below is brilliant.  Some
  33.                   demonstrates very poor programming techniques.  But
  34.                   all of it can prove useful if you have a need.
  35.  
  36.                   NOTE 1:
  37.  
  38.                   We have NOT tried all the code you see here, and some
  39.                   of it may not run as-is.  You may have to do a little
  40.                   editing to coax it.  One reason that code may not run
  41.                   is that messages sometimes get truncated or mangled in
  42.                   transmission.  Another reason is that authors make
  43.                   mistakes (or typos).  Again, we haven't tried running
  44.                   everything; but when you do, you'll probably quickly
  45.                   spot places that need editing.
  46.  
  47.                   NOTE 2:
  48.  
  49.                   There may be near-duplicate messages.  The original
  50.                   author may have refined the code, or may have found
  51.                   errors in the original.  If you see something that
  52.                   looks interesting, before you rely on the code, scan
  53.                   for the topic or author to see if a new set of code is
  54.                   below you -- more recent messages appear below. And
  55.                   note that the next message may be in a later package.
  56.  
  57.                   NOTE 3:
  58.  
  59.                   BEFORE running any code segment, scan through it and
  60.                   LOOK FOR code fragments which could be DISASTROUS!
  61.  
  62.                   *** We often run un-tested code fragments from a  ***
  63.                   *** RAM or floppy disk.  And BEFORE running it we ***
  64.                   *** scan for "c:" or "d:" (or other hard drive)   ***
  65.                   *** letters.  And we also scan for .. (see below) ***
  66.  
  67.  
  68.                   For example, scan for "OUT " -- and if you find any
  69.                   verify that the code is OUTting the correct values
  70.                   to the correct ports.  Typos, transmission errors
  71.                   or programmer mistakes could send the wrong values
  72.                   to the wrong ports.  At best, nothing will happen.
  73.                   At worst, you might fry your monitor -- or worse.
  74.  
  75.                   Also look for INTERRUPT (or INTERRUPTx).  These functions
  76.                   are v-e-r-y useful for invoking low-level DOS or BIOS
  77.                   functions.  But that low-level access also comes with
  78.                   some risks!  Programmer or transmission errors, open
  79.                   drive doors, etc., can, at best, cause your PC to hang.
  80.                   At worst, you could corrupt the FAT of your hard disk.
  81.  
  82.  
  83. =========================================================================
  84.  
  85.  
  86. Msg #:  2135                      QUIKBAS Subboard
  87.  From:  PETER MIKALAJUNAS         Sent: 11-22-93 21:16
  88.    To:  MARVIN HART               Rcvd: -NO-
  89.    Re:  ANSI FULL SCREEN EDIT 1/2
  90.  
  91. MH>No I'm not speaking about a program to design ansi screens. I'm
  92. looking MH>for an (ansi based controlls) full screen editor so that I
  93. can add it to MH>a bbs so users can have the option of wrtting,
  94. replying to mail in MH>a line by line format or full screen. Sorry for
  95. not explaining MH>what I'm looking for in better detail.
  96.  
  97. This should give you a push in the right direction.  Not sure who the
  98. author is, had it laying around.  For full ansi support look at Pansi.
  99.  
  100. ' TEXTWIN.BAS
  101. ' This Sample program shows how to use
  102. ' TextWindow -- a function that allows
  103. ' a user to enter a window of text
  104. DEFINT A-Z
  105. DECLARE FUNCTION TextWindow (Buffer$, Lines, Columns, x, y)
  106. DECLARE SUB MakeBox (x, y, Lines, Columns)
  107. CLS
  108. LOCATE 15, 1: PRINT "Here are the results: "
  109. 'declare Text Window size
  110. TextLines = 10: TextCols = 64
  111. Xwindow = 3: Ywindow = 10
  112. 'declare buffer area to hold text
  113. Buffer$ = SPACE$(TextLines * TextCols)
  114. ' call text window
  115. ExitOK = TextWindow(Buffer$, TextLines, TextCols, Xwindow, Ywindow)
  116. IF ExitOK THEN
  117.  PRINT Buffer$
  118. ELSE
  119.  PRINT "Window not Saved"
  120. END IF
  121. END
  122. SUB MakeBox (x, y, Lines, Columns)
  123. ' Draw a single line box beginning at X,Y
  124. ' box is Lines tall by Columns wide
  125. DEFINT A-Z
  126. ' top row
  127. LOCATE x, y, 0
  128. PRINT CHR$(218);
  129. PRINT STRING$(Columns - 2, CHR$(196));
  130. PRINT CHR$(191)
  131. 'bottom row
  132. LOCATE x + Lines - 1, y, 0
  133. PRINT CHR$(192);
  134. PRINT STRING$(Columns - 2, CHR$(196));
  135. PRINT CHR$(217)
  136. 'sides
  137. FOR I = 1 TO Lines - 2
  138.    LOCATE x + I, y, 0: PRINT CHR$(179)
  139.    LOCATE x + I, y + Columns - 1, 0
  140.    PRINT CHR$(179)
  141. NEXT I
  142. END SUB
  143. FUNCTION TextWindow (Buffer$, Lines, Columns, Xwindow, Ywindow)
  144. ' This function allows the user to key in a window
  145. ' of text the input area will be Lines by Columns
  146. ' in size.  xwindow and ywindow are the upper left
  147. ' corner coordinates of text entry window
  148. ' The text is placed in Buffer$
  149. ' returns TRUE if user saves with Ctrl-End,
  150. ' FALSE on Esc
  151. 'save cursor position
  152. SaveX = CSRLIN: SaveY = POS(0)
  153. ' Scan codes for current valid user key-strokes
  154. ScanKeyhome = 71
  155. ScanKeyend = 79
  156. ScanKeyup = 72
  157. ScanKeyleft = 75
  158. ScanKeyright = 77
  159. ScanKeydown = 80
  160. ScanKeyctrlleft = 115
  161. ScanKeyctrlright = 116
  162. ScanKeyinsert = 82
  163. ScanKeydelete = 83
  164. ScanKeyctrlend = 117
  165. ScanKeyenter = 13
  166. ScanKeyescape = 27
  167. ScanKeybackspace = 8
  168. 'Start with insert mode turned off
  169. FALSE = 0
  170. TRUE = NOT FALSE
  171. inserton = FALSE
  172. ' Draw box around text, display marquis
  173. CALL MakeBox(Xwindow - 1, Ywindow - 1, Lines + 3, Columns + 2)
  174. LOCATE Xwindow + Lines, Ywindow + 1, 0
  175. PRINT "[Esc] to Abort,[Ctrl-End] to Save"
  176. 'Current X,Y Coordinates of cursor within window
  177. XCoord = Xwindow: YCoord = Ywindow
  178. 'start taking text in top left corner
  179. LOCATE XCoord, YCoord, 1
  180. 'main user input loop
  181.  
  182. DO
  183.   UserKey$ = INKEY$
  184.   SELECT CASE LEN(UserKey$)
  185.     CASE 2 'two-byte scan codes
  186.       SELECT CASE ASC(RIGHT$(UserKey$, 1))
  187.         CASE ScanKeyhome
  188.           XCoord = Xwindow: YCoord = Ywindow
  189.         CASE ScanKeyend
  190.           XCoord = Xwindow + Lines - 1
  191.           YCoord = Ywindow + Columns - 1
  192.         CASE ScanKeyup
  193.           IF XCoord > Xwindow THEN
  194.             XCoord = XCoord - 1
  195.           END IF
  196.         CASE ScanKeyleft
  197.           IF YCoord > Ywindow THEN
  198.             YCoord = YCoord - 1
  199.           END IF
  200.         CASE ScanKeyright
  201.           IF YCoord < Ywindow + Columns - 1 THEN
  202.             YCoord = YCoord + 1
  203.           END IF
  204.         CASE ScanKeydown
  205.           IF XCoord < Xwindow + Lines - 1 THEN
  206.             XCoord = XCoord + 1
  207.           END IF
  208.         CASE ScanKeyctrlleft
  209.           GOSUB LeftWord
  210.         CASE ScanKeyctrlright
  211.           GOSUB RightWord
  212.         CASE ScanKeyinsert
  213.           inserton = NOT inserton
  214.           LOCATE 25, 50, 0
  215.           IF inserton THEN
  216.             PRINT "Insert mode";
  217.           ELSE
  218.             PRINT SPACE$(11);
  219.           END IF
  220.         CASE ScanKeydelete
  221.           GOSUB MoveLeft
  222.         CASE ScanKeyctrlend
  223.           TextWindow = TRUE
  224.           EXIT DO
  225.         CASE ELSE
  226.           PRINT ASC(RIGHT$(UserKey$, 1))
  227.       END SELECT
  228.       LOCATE XCoord, YCoord, 1
  229.     CASE 1 'single-character scan codes
  230.       SELECT CASE ASC(UserKey$)
  231.         CASE ScanKeyenter
  232.           IF XCoord < Lines + Xwindow - 1 THEN
  233.             XCoord = XCoord + 1
  234.           END IF
  235.           YCoord = Ywindow
  236.           LOCATE XCoord, YCoord, 1
  237.         CASE ScanKeyescape
  238.           TextWindow = FALSE
  239.           EXIT DO
  240.         CASE ScanKeybackspace
  241.           IF YCoord > Ywindow THEN
  242.             YCoord = YCoord - 1
  243.             GOSUB MoveLeft
  244.           END IF
  245.           LOCATE XCoord, YCoord, 1
  246.         CASE ELSE
  247.           IF inserton THEN
  248.             GOSUB MoveRight
  249.           END IF
  250.           GOSUB UpdateBuffer
  251.           LOCATE XCoord, YCoord, 1
  252.           PRINT UserKey$;
  253.           IF YCoord < Columns + Ywindow - 1 THEN
  254.             YCoord = YCoord + 1
  255.           END IF
  256.       END SELECT
  257.     END SELECT
  258. LOOP
  259. 'End of main user input loop
  260. 'restore cursor position
  261. LOCATE SaveX, SaveY, 1
  262. EXIT FUNCTION
  263. UpdateBuffer:
  264. ' put the character typed into the string buffer
  265.    GOSUB ComputeBufPosn
  266.    MID$(Buffer$, BufPosn, 1) = UserKey$
  267. RETURN
  268. MoveLeft:
  269. ' move characters left on delete or backspace
  270.    SaveYCoord = YCoord
  271.    FOR YCoord = SaveYCoord + 1 TO Ywindow + Columns - 1 STEP 1
  272.       GOSUB ComputeBufPosn
  273.       OldChar$ = MID$(Buffer$, BufPosn, 1)
  274.       LOCATE XCoord, YCoord - 1, 0
  275.       PRINT OldChar$;
  276.       MID$(Buffer$, BufPosn - 1, 1) = OldChar$
  277.    NEXT YCoord
  278.    MID$(Buffer$, BufPosn, 1) = " "
  279.    LOCATE XCoord, YCoord - 1, 1
  280.    PRINT " "
  281.    YCoord = SaveYCoord
  282.    GOSUB ComputeBufPosn
  283. RETURN
  284.  
  285. MoveRight:
  286. ' move characters right on insert
  287.  
  288.    SaveYCoord = YCoord
  289.    FOR YCoord = Ywindow + Columns - 2 TO YCoord STEP -1
  290.       GOSUB ComputeBufPosn
  291.       OldChar$ = MID$(Buffer$, BufPosn, 1)
  292.       LOCATE XCoord, YCoord + 1, 0
  293.       PRINT OldChar$;
  294.       MID$(Buffer$, BufPosn + 1, 1) = OldChar$
  295.    NEXT YCoord
  296.    YCoord = SaveYCoord
  297.    GOSUB ComputeBufPosn
  298.    MID$(Buffer$, BufPosn, 1) = " "
  299.    LOCATE XCoord, YCoord, 1
  300.    PRINT " ";
  301. RETURN
  302.  
  303. LeftWord:
  304. 'Find the next word to the left
  305.  
  306.    GOSUB ComputeBufPosn
  307.    IF BufPosn > 1 THEN BufPosn = BufPosn - 1
  308.    CharsSeen = FALSE
  309.    WordFound = FALSE
  310.    DO
  311.       ThisChar$ = MID$(Buffer$, BufPosn, 1)
  312.       CharsSeen = CharsSeen OR (ThisChar$ <> " ")
  313.       IF CharsSeen AND (ThisChar$ = " ") THEN
  314.          WordFound = TRUE
  315.       ELSE
  316.          BufPosn = BufPosn - 1
  317.       END IF
  318.    LOOP UNTIL WordFound OR BufPosn = 0
  319.    GOSUB ComputeCoords
  320.    LOCATE XCoord, YCoord, 1
  321. RETURN
  322.  
  323. RightWord:
  324. 'Find the next word to the right
  325.  
  326.    GOSUB ComputeBufPosn
  327.    SpacesSeen = FALSE
  328.    WordFound = FALSE
  329.    DO
  330.       ThisChar$ = MID$(Buffer$, BufPosn, 1)
  331.       SpacesSeen = SpacesSeen OR (ThisChar$ = " ")
  332.       IF SpacesSeen AND (ThisChar$ <> " ") THEN
  333.          WordFound = TRUE
  334.       ELSE
  335.          IF BufPosn < Lines * Columns THEN BufPosn = BufPosn + 1
  336.       END IF
  337.    LOOP UNTIL WordFound OR BufPosn = Lines * Columns
  338.    BufPosn = BufPosn - 1
  339.    GOSUB ComputeCoords
  340.    LOCATE XCoord, YCoord, 1
  341. RETURN
  342.  
  343. ComputeBufPosn:
  344. ' Compute current position within buffer
  345.  
  346.    BufPosn = ((XCoord - Xwindow) * Columns) + YCoord - Ywindow + 1
  347. RETURN
  348.  
  349. ComputeCoords:
  350. 'Compute screen Coordinates of relative BufPosn
  351.  
  352.    XCoord = Xwindow + INT(BufPosn / Columns)
  353.    YCoord = Ywindow + (BufPosn MOD Columns)
  354. RETURN
  355.  
  356. END FUNCTION
  357.  
  358.  
  359.  
  360.  From:  BRIAN MCLAUGHLIN          Sent: 12-02-93 16:48
  361.    To:  DAWNY WEBSTER             Rcvd: -NO-
  362.    Re:  EDITOR IN QB 1.0      1/2
  363.  
  364. DW>Does anybody here know how to program a text editor in QuickBasic 1.0??
  365. DW>figure out how to use line wrap, or be able to move the cursor up a line, or
  366. DW>how to load a text file for editing. Surely somebody knows how??
  367.  
  368. Writing a text editor is complicted enough that you'll want to break it
  369. down into lots of pieces (many SUBs and FUNCTIONs).  This code should
  370. give you a start...there's obviously no way to post code for an entire
  371. text editor in one swoop! Even if I could, that would rob you of the
  372. joy of discovery <grin>.
  373.  
  374. For line wrapping you might think about searching for a break between
  375. words, by searching _backwards_ for the space nearest the end of a line
  376. that is too long, using FOR/NEXT with STEP -1.
  377.  
  378. ' LINEEDIT.BAS
  379.  
  380. DECLARE FUNCTION LineEdit$ (Row%, Col%, EntryLen%, Prompt$)
  381.  
  382. Row% = 4: Col% = 4
  383. EntryLen% = 55           'number of spaces the entry can occupy
  384. Prompt$ = "Write here: "
  385.  
  386. CLS
  387. OutString$ = LineEdit$(Row%, Col%, EntryLen%, Prompt$)
  388. LOCATE CSRLIN + 2, 4
  389. PRINT "You said:   "; OutString$
  390. END
  391.  
  392. '====================================================
  393.  FUNCTION LineEdit$ (Row%, Col%, EntryLen%, Prompt$)
  394. '====================================================
  395.  
  396.   CONST TRUE = -1, FALSE = 0
  397.  
  398.   DO: LOOP WHILE LEN(INKEY$)  'clears any impending keys
  399.   LOCATE Row%, Col%
  400.  
  401.   PRINT Prompt$;
  402.   Col% = POS(0)
  403.   AllLength% = Col% + EntryLen%
  404.   IF AllLength% > 79 THEN EntryLen% = EntryLen% - (AllLength% - 80)
  405.  
  406.   SHOW$ = STRING$(EntryLen%, CHR$(176))   'use squares
  407.   PRINT SHOW$;
  408.   LOCATE Row%, Col%, 1, 7, 1              'a big cursor
  409.  
  410. ' -----------------------------
  411. ' START OF MAIN PROCEDURE LOOP
  412. ' -----------------------------
  413.  
  414.  DO                                   'it keeps going and going and going
  415.       DO
  416.         Akey$ = INKEY$                ' wait for some kind of input
  417.       LOOP UNTIL LEN(Akey$)
  418.  
  419.       IF LEN(Akey$) = 1 THEN
  420.          Ky% = ASC(Akey$)
  421.       ELSE                       'it must be an extended key like F1
  422.          Char2$ = RIGHT$(Akey$, 1)
  423.          Ky% = ASC(Char2$) * -1  'convert the keycode to a negative number
  424.       END IF
  425.  
  426.       SELECT CASE Ky%
  427.         CASE 13                       'on ENTER break out of LOOP
  428.            EXIT DO
  429.         CASE -75                      ' on LEFT ARROW move left one position
  430.           IF (Cpos% > 0) THEN
  431.              Cpos% = Cpos% - 1
  432.              LOCATE Row%, Col% + Cpos%
  433.           END IF
  434.         CASE -77                      ' on RIGHT ARROW move right
  435.           IF (Cpos% < Length%) THEN
  436.              Cpos% = Cpos% + 1
  437.              LOCATE Row%, Col% + Cpos%
  438.           END IF
  439.         CASE -79                      ' on END go to end of line
  440.           Cpos% = Length%
  441.           LOCATE Row%, Col% + Cpos%
  442.         CASE -71                      ' on HOME go to start of line
  443.           Cpos% = 0
  444.           LOCATE Row%, Col% + Cpos%
  445.         CASE -83                      ' on a DEL keypress
  446.           IF (Length% > 0) AND (Cpos% < Length%) THEN
  447.              Temp1$ = LEFT$(OutPut$, Cpos%)
  448.              Temp2$ = RIGHT$(OutPut$, Length% - Cpos% - 1)
  449.              OutPut$ = Temp1$ + Temp2$
  450.              Length% = Length% - 1
  451.              LOCATE Row%, Col%
  452.              PRINT OutPut$ + CHR$(176);
  453.              LOCATE Row%, Col% + Cpos%
  454.           END IF
  455.         CASE 8                        ' on BACKSPACE
  456.           IF (Length% > 0) AND (Cpos% > 0) THEN
  457.              Temp1$ = LEFT$(OutPut$, Cpos% - 1)
  458.              Temp2$ = RIGHT$(OutPut$, (Length% - Cpos%))
  459.              OutPut$ = Temp1$ + Temp2$
  460.              Length% = Length% - 1
  461.              Cpos% = Cpos% - 1
  462.              LOCATE Row%, Col%
  463.              PRINT OutPut$ + CHR$(176);
  464.              LOCATE Row%, Col% + Cpos%
  465.           END IF
  466.         CASE 32 TO 126              'our "printable" characters
  467.           IF (Length% < EntryLen%) THEN
  468.              Temp1$ = LEFT$(OutPut$, Cpos%)
  469.              Temp2$ = RIGHT$(OutPut$, Length% - Cpos%)
  470.              OutPut$ = Temp1$ + CHR$(Ky%) + Temp2$
  471.              Length% = Length% + 1
  472.              Cpos% = Cpos% + 1
  473.              LOCATE Row%, Col%
  474.              PRINT OutPut$;
  475.              LOCATE Row%, Col% + Cpos%
  476.           END IF
  477.       END SELECT
  478.  LOOP
  479.  
  480.   LOCATE , , 0           'turns the cursor off
  481.   LineEdit$ = OutPut$
  482.  
  483. END FUNCTION
  484.  
  485.  
  486.  
  487. 'Msg #:  2475                      QUIKBAS Subboard
  488. ' From:  SAM JONES                 Sent: 12-03-93 15:30
  489. '   To:  ALL                       Rcvd: 12-07-93 13:26
  490. '   Re:  HUFFMAN COMP
  491. '
  492. 'Hey all, well I a recently got a Hufman algrorithm for BASIC. Sadly it
  493. 'was made only for PowerBasic and I use QuickBasic.  Could some of you
  494. 'guys out there with both QB/PB experience possibly modify the code ??
  495.  
  496. CLS
  497. InFile$="A SIMPLE STRING TO BE ENCODED USING A MINIMAL NUMBER OF BITS"
  498.  
  499. CALL Huffman(InFile$,OutFile$,NewFile$)
  500. print:print:print
  501. PRINT "In:  ";LEN(InFile$);InFile$
  502. PRINT "Out: ";LEN(OutFile$)
  503. PRINT "New: ";LEN(NewFile$);NewFile$
  504. input,r
  505.  
  506. END
  507. '**********************************************************************
  508. '   Huffman Encoding File Compression Technique
  509. '
  510. '   From: R Sedgwick.  Algorithms.  Reading, MA: Addison-Wesley.
  511. '                      1984.  Second Ed.  pp  286 / 93.
  512. '
  513. '   Converted to Power Basic by M. Rosenberg CI$: [73707,2545]
  514. '
  515. SUB Huffman(InText$,OutText$,NewText$)
  516.     SHARED N%,Heap%(),Count%()
  517.     DIM Count%(1024),Heap%(1024),Dad%(1024),Code%(256),Leng%(256)
  518.  
  519. ' Count the frequency of each character in the message to be encoded (P. 287)
  520.     FOR I%=0 to 255 : Count%(I%)=0 : NEXT I%
  521.     Csr%=0
  522.     DO : INCR Csr% : X%=ASC(MID$(InText$,Csr%,1)) : INCR Count%(X%)
  523.          LOOP UNTIL Csr%=LEN(InText$)
  524.  
  525. ' Initialize the heap array to point to non-zero frequency counts (P. 290)
  526.  
  527.     N%=0 : FOR I%=0 to 255 : IF Count%(I%)<>0 THEN INCR N% : Heap%(N%)=I%
  528.            NEXT I%
  529. ' Construct an indirect heap on the frequency values (P. 289)
  530.  
  531.     FOR K% = N% TO 1 STEP -1 : CALL PqDownHeap(K%) : NEXT K%
  532.  
  533. ' Construct the trie (P. 290)
  534.     DO : T%=Heap%(1) : Heap%(1)=Heap%(N%) : DECR N%
  535.              CALL PqDownHeap(1)
  536.              Count%(255+N%)=Count%(Heap%(1))+Count%(T%)
  537.              Dad%(T%)=255+N% : Dad%(Heap%(1))=-255-N%
  538.              Heap%(1)=255+N% : CALL PqDownHeap(1)
  539.     LOOP UNTIL N%=1
  540.     Dad%(255+N%)=0
  541.  
  542. ' Reconstruct the information from the representation of the coding tree (P.291)
  543. '    computed during the sifting process.
  544.  
  545.     FOR K% = 0 TO 255
  546.         IF Count%(K%)=0 THEN
  547.            Code%(K%)=0 : Leng%(K%)=0
  548.         ELSE
  549.            I%=0 : J&=1 : T%=Dad%(K%) : X%=0
  550.            DO : IF T%<0 THEN X%=X%+J& : T%=0-T%
  551.                 T%=Dad%(T%) : J&=J&+J& : INCR I%
  552.            LOOP UNTIL T%=0
  553.            Code%(K%)=X% : Leng%(K%)=I%
  554.         END IF
  555.     NEXT K%
  556. ' Use the computed representations of the code to encode the string (P. 292)
  557.  
  558.     J%=0 : OutText$="" : Hold$=""
  559.     DO : INCR J%
  560.              Char%=ASC(MID$(InText$,J%,1)) : Compr$=BIN$(Code%(Char%))
  561.              DO WHILE LEN(Compr$)< Leng%(Char%) : Compr$="0"+Compr$ : LOOP
  562.              Hold$=Hold$+Compr$
  563.              IF LEN(Hold$)>8 THEN
  564.                           
  565.                 OutText$=OutText$+CHR$(Bin2Int(LEFT$(Hold$,8))) Hold$=RIGHT$(Hold$,LEN(Hold$)-8)
  566.              END IF
  567.     LOOP UNTIL J%=LEN(InText$)
  568.  
  569. ' Add a byte at the end that contains any left-over bits
  570.  
  571.     IF LEN(Hold$)>0 THEN
  572.              Hold$=Hold$+STRING$(8-LEN(Hold$),"0")
  573.              OutText$=OutText$+CHR$(Bin2Int(LEFT$(Hold$,8)))
  574.     END IF
  575. '**********************************************************************
  576. ' Unpack compressed string into character representation of binary
  577.  
  578.     J%=0 : UnCompr$="" : NewText$=""
  579.     DO : INCR J%
  580.          Hold$=MID$(OutText$,J%,1) : Hold$=BIN$(ASC(Hold$))
  581.          DO WHILE LEN(Hold$)<8 : Hold$="0"+Hold$ : LOOP
  582.          UnCompr$=UnCompr$+Hold$
  583.     LOOP UNTIL J%=LEN(OutText$)
  584.  
  585. ' Decode compressed string
  586.  
  587.     DO : FOR  K%=1 TO 256
  588.          IF K%=256 THEN EXIT LOOP 'All done
  589.          IF Leng%(K%)>0 THEN
  590.             IF Bin2Int(LEFT$(UnCompr$,Leng%(K%)))=Code%(K%) THEN
  591.                                                                      
  592.                UnCompr$=RIGHT$(UnCompr$,LEN(UnCompr$)-Leng%(K%))
  593.                NewText$=NewText$+CHR$(K%) : EXIT FOR
  594.             END IF
  595.         END IF
  596.         NEXT K%
  597.     LOOP UNTIL LEN(UnCompr$) = 0
  598.  
  599.  
  600. END SUB 'Huffman
  601.  
  602. SUB PqDownHeap(K%)
  603. ' Build and maintain an indirect heap on the frequency values (P. 139)
  604. '     reversing the inequalities since we want the smallest values first.
  605.  
  606.     SHARED N%,Heap%(),Count%()
  607.     LOCAL J%,V%,Limit%
  608.     V%=Heap%(K%) : Limit% = N%/2
  609.     DO WHILE K% <= Limit%
  610.        J%=K%+K%
  611.        IF J%<N% THEN IF Count%(Heap%(J%)) > Count%(Heap%(J%+1)) THEN INCR J%
  612.        IF Count%(V%)<=Count%(Heap%(J%)) THEN Heap%(K%)=V% : EXIT SUB
  613.        Heap%(K%)=Heap%(J%) : Heap%(J%)=V% : K%=J%
  614.     LOOP
  615. END SUB 'PqDownHeap
  616.  
  617. '**********************************************************************
  618. FUNCTION Bin2Int(X$)
  619. X$=RTRIM$(X$) :X$=LTRIM$(X$) : Ll%=LEN(X$) : Ex%=0 : Tot%=0 : I%=Ll%
  620.     DO WHILE I% > 0
  621.         IF MID$(X$,I%,1)="1" THEN Tot&=Tot&+(2^Ex&)
  622.         INCR Ex& : DECR I% : WEND
  623.     Bin2Int=Tot&
  624. END FUNCTION 'Bin2Int
  625.  
  626.  
  627.  
  628.  
  629.  
  630. Msg #:  2575                      QUIKBAS Subboard
  631.  From:  CALVIN FRENCH             Sent: 12-06-93 00:00
  632.    To:  ALL                       Rcvd: -NO-
  633.    Re:  HEH...
  634.  
  635.         
  636.    * M * E * R * R * Y  C * H * R * I * S * T * M * A * S * !
  637.  
  638.    Awhile back there was some kind of wierd QB "demo" contest.
  639. Anyways I wrote a little demo but it really wasn't all that good and
  640. the contest sort of died, so I've decided to give it to you all as
  641. a merry christmas present!
  642.  
  643.    Here's what to do to run this happy little 3 part demo. Take the
  644. message "GRAPHIC1" and save it to disk. Take it into Qb, edit out all
  645. the non-qb text, run it. Then make a directory C:\DEMO (or whatever) and
  646. PKUNZIP GRAPHICS.ZIP to C:\DEMO (or whatever). Next, save the .BAS file
  647. messages to the same directory (you should save everything to that
  648. directory so you can delete it afterwards). Run the file DEMOPREP.BAS
  649. first. It should generate "SURPRISE.PIC"... (you'll have some idea when
  650. you see it). Now, you should have a bunch of .GFX files (made in Tile
  651. Draw), SURPRISE.PIC, and CALVIN.BAS. That's it. Compile CALVIN.BAS,
  652. unload EMM386/SMARTDRV (they slow things down a LOT) and run it! Have
  653. fun everybody, and merry christmas!
  654.  
  655.    - Calvin -
  656.  
  657. ... Never enter a battle of wits unarmed.
  658. ___ Blue Wave/QWK v2.12
  659.  
  660. --- Maximus 2.01wb
  661.  * Origin: RJ's Byteline =[HST/DS]= Calgary (403)247-3180 CANADA
  662. (1:134/75)
  663.  
  664.  
  665.  
  666. Msg #:  2576                      QUIKBAS Subboard
  667.  From:  CALVIN FRENCH             Sent: 12-06-93 00:00
  668.    To:  ALL                       Rcvd: -NO-
  669.    Re:  [1/1] GRAPHICS.ZIP
  670.  
  671. '>>> Page 1 of GRAPHICS.ZIP begins here. TYPE:BINAA TLEN:2990
  672. DEFINT A-Z:DIM SHARED K,S,B&,Z&:V1 'Created by PostIt! 7.1
  673. SUB V1:OPEN "O",1,"GRAPHICS.ZIP",4^6:Z&=2990:?STRING$(50,177);
  674. U"%up()%9%%%[-%b)8%#Z?*D8$%7%%\%%%%1%%%%FU%UUUU%UVSlpk'\\&2e,/7-%
  675. U"[NCGO'W&z)(uu'3332iyYWhkzPC(jdz(7'I'O7-E1O8/%$OChO7%JJv+T*_5y%%
  676. U"%up(%)9%%%%-%s$)%#8/lBz_[%%%\%%%%1%%%%F%UUUU%UUWSdlk'\*\2e(a/A%
  677. U"A%zi%UA&.+oM+DDD#Zz:4C]&(d/ZOz+.)m+z.5e?z99%Gz\U%J%<oq3/6NFw%%%
  678. U"up(%)9%%%%-%lE)%#V)+8$c[%%%\%%%%1%%%%F%UUUU%UUXSdlk'\<\29%[/U%_
  679. U"%NG%m%sv.+R9:9+2DDDZ.z:4]J&(dZ(Oz+)(m+z5^e?z9F%GzU[%=<RJ-Y&p'4>
  680. U"*%%%up(%)9%%#%-%'E)%#=7Uy1e[%%%\%%%%1%%%%F%UUUU%UUYSdlk'\<\29)[
  681. U"/5%^FN;%S&v)(EN7QqaZ333iVyY+aJq'SzGPCjd%z('I''O-E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%%%%I*%%%FU%UUU
  727. U"U%VZSl(k'up%&'9%%9%%%I-%Co8=#Yl)r89%7%%\%%%%1%%%%%%%%%&%%E%%%&(
  728. U"*%%%ktwr%UUUV#Slk'%up&'%9%9%%%%-%15q=#Iken[%]%%%'\%%%%1%%%%%%%%
  729. U"%&%E%.%%f*%%%kt%wrUU%UWSl(k'up%&'9%%9%%%I-%;sA=#To)WOM%7%%\%%%%
  730. U"1%%%%%%%%%&%%E%%%'r*%%%ktwr%UUUX#Slk'%up&'%9%9%%%%-%2dp=#s;%3F%
  731. U"]%%%'\%%%%1%%%%%%%%%&%E%%%%p+%%%kt%wrUU%UYSl(k'up%&'9%%9%%%R-%,
  732. U"pS=#p-%\q^%7%%\%%%%1%%%%%%%%%&%%E%%%'&+%%%ktwr%UUUZ#Slk'%up*+%%
  733. U"%%%%9%9%&W)%%%5,%%%%%
  734. END SUB
  735. CLOSE:IF S=243AND B&=Z&THEN?" :) Ok!"ELSE?" :( Bad!
  736. SUB U(A$):FOR A=1TO LEN(A$):C=ASC(MID$(A$,A))-37:IF C<0THEN C=91+C*32
  737. IF K<4THEN K=C+243ELSE?#1,CHR$(C+(K MOD 3)*86);:K=K\3:B&=B&+1
  738. S=(S+C)AND 255:NEXT:LOCATE,1:?STRING$(B&*50\Z&,219);:END SUB
  739. '>>> Page 1 of GRAPHICS.ZIP ends here. Last page. TCHK:243
  740.  
  741.  
  742.  
  743. Msg #:  2577                      QUIKBAS Subboard
  744.  From:  CALVIN FRENCH             Sent: 12-06-93 00:00
  745.    To:  ALL                       Rcvd: -NO-
  746.    Re:  [1/2] DEMOPREP.BAS
  747.  
  748. '>>> Page 1 of DEMOPREP.BAS begins here. TYPE:BAS
  749. DEFINT A-Z
  750.  
  751. DECLARE SUB TransArray ()
  752. DECLARE SUB CalcTables (sine(), cosi(), logi())
  753. DECLARE SUB SaveImage ()
  754. DECLARE SUB Mode13h ()
  755. DECLARE SUB Mode03h ()
  756. DECLARE SUB SetPalette ()
  757. DECLARE SUB SetPalColour (Colour, Red, Green, Blue)
  758. DECLARE SUB SetColor (x, y, Colour)
  759.  
  760. DIM sine(360)
  761. DIM cosi(360)
  762. DIM logi(360)
  763.  
  764. CalcTables sine(), cosi(), logi()
  765. Mode13h
  766. SetPalette
  767. TransArray
  768. SaveImage
  769. Mode03h
  770.  
  771. END
  772.  
  773. SUB CalcTables (sine(), cosi(), logi())
  774.  
  775. PRINT
  776. PRINT "This creates a little picture for use in my QB demo..."
  777. PRINT "Calvin French 1993"
  778. PRINT
  779. PRINT "Please wait. I'm calculating some tables."
  780. PRINT
  781. YLoc = CSRLIN
  782. PRINT STRING$(80, 176);
  783.  
  784. FOR n = 1 TO 360
  785.   sine(n) = SIN(n / 57) * 1024
  786.   cosi(n) = COS(n / 57) * 1024
  787.   logi(n) = LOG(n / 57) * 1024
  788.   LOCATE YLoc, 1
  789.   PRINT STRING$(n / 360 * 80, 177);
  790. NEXT n
  791.  
  792. END SUB
  793.  
  794. SUB Mode03h
  795.  
  796. SCREEN 0
  797. WIDTH 80
  798.  
  799. END SUB
  800.  
  801. SUB Mode13h
  802.  
  803. SCREEN 13
  804.  
  805. END SUB
  806.  
  807. SUB SaveImage
  808.  
  809. DEF SEG = &HA000
  810. BSAVE "SURPRISE.PIC", 0, 64000
  811. DEF SEG
  812.  
  813. END SUB
  814.  
  815. SUB SetColor (x, y, Colour)
  816.  
  817. 'DEF SEG = &HA000
  818. 'POKE (x + y * 320), Colour
  819. 'DEF SEG
  820.  
  821. PSET (x, y), Colour
  822.  
  823. END SUB
  824.  
  825. SUB SetPalColour (Colour, Red, Green, Blue)
  826.  
  827. OUT &H3C8, Colour
  828. OUT &H3C9, Red
  829. OUT &H3C9, Green
  830. OUT &H3C9, Blue
  831.  
  832. END SUB
  833.  
  834. SUB SetPalette
  835.  
  836. FOR k = 0 TO 15 STEP 1
  837.   FOR l = 0 TO 15 STEP 1
  838.     SetPalColour k + 15 * l + 1, 4 * (k MOD 15), 4 * (l MOD 15), 63
  839.  
  840.  
  841. '                        setpalcol(k+15*l+1,4*(k%15),4*(l%15),63);
  842. '                        setpalcol(0,0,0,0);
  843.   NEXT l
  844. NEXT k
  845.  
  846. END SUB
  847.  
  848. SUB TransArray
  849.  
  850. SHARED sine()
  851. SHARED cosi()
  852. SHARED logi()
  853.  
  854. FOR d& = 1 TO 360
  855.   FOR r = 1 TO 360
  856.     z = logi(d&) \ 32
  857.     IF z = 0 THEN z = 1
  858.     x = 160 + (sine(r) * d&) \ 1024
  859.     y = 100 + ((cosi(r) * d&) \ 1024 * 2) - z
  860.     c = ((r * 2) MOD 15) + 15 * ((d& * 3) MOD 15) + 1
  861.     LINE -(x, y), c
  862.   NEXT
  863. NEXT
  864.  
  865. END SUB
  866.  
  867.  From:  CALVIN FRENCH             Sent: 12-06-93 00:00
  868.    To:  ALL                       Rcvd: -NO-
  869.    Re:  [1/6] CALVIN.BAS
  870.  
  871. '>>> Page 1 of CALVIN.BAS begins here. TYPE:BAS
  872. DEFINT A-Z
  873.  
  874. DECLARE SUB LoadColorBob (ImgFile$, Img%(), ImgExt%)
  875.  
  876. DECLARE SUB Welcome ()
  877. DECLARE SUB ColorBobical1 ()
  878. DECLARE SUB ColorBobical2 ()
  879. DECLARE SUB ColorBobical3 ()
  880. DECLARE SUB ByeBye ()
  881.  
  882. TYPE StarType
  883.   Angle AS INTEGER
  884.   Speed AS INTEGER
  885.   Brite AS INTEGER
  886.   RealX AS INTEGER
  887.   RealY AS INTEGER
  888.   Dis   AS INTEGER
  889. END TYPE
  890.  
  891. SCREEN 13
  892.  
  893. RANDOMIZE TIMER
  894.  
  895. Welcome
  896. ColorBobical1
  897. ColorBobical2
  898. ColorBobical3
  899. ByeBye
  900.  
  901. END
  902.  
  903. SIP:
  904. IF t > 5 THEN
  905.   ip = (ip + 1) MOD 5
  906.   IF ip = 0 THEN ip = 1
  907. ELSE
  908.   t = t + 1
  909. END IF
  910. RETURN
  911.  
  912. SUB ByeBye
  913.  
  914. SCREEN 0
  915. WIDTH 80
  916. COLOR 15, 3
  917. PRINT "                                                               
  918. "+_
  919. "                "
  920. PRINT "  Well, bye! I hope you enjoyed the demo. I diddn't spend a"+_
  921. " whole lot of time   "
  922. PRINT "  on it, granted, but it's okay anyways... Have fun!           
  923. "+_
  924. "                "
  925. PRINT "  - Calvin French - FidoNet 1:134/75 (RJ's Byteline)           
  926. "+_
  927. "                "
  928. PRINT "                                                               
  929. "+_
  930. "                "
  931. COLOR 7, 0
  932. PRINT
  933. PRINT
  934. PRINT
  935.  
  936. END SUB
  937.  
  938. SUB ColorBobical1
  939.  
  940. SCREEN 13
  941. CLS
  942.  
  943. DIM Img(15, 15, 29)
  944.  
  945. OUT &H3C8, 0
  946. FOR n = 1 TO 255
  947.   OUT &H3C9, 0
  948.   OUT &H3C9, 0
  949.   OUT &H3C9, 0
  950. NEXT n
  951.  
  952. LoadColorBob "!0000001.GFX", Img(), 0
  953. LoadColorBob "!0000002.GFX", Img(), 1
  954. LoadColorBob "!0000003.GFX", Img(), 2
  955. LoadColorBob "!0000004.GFX", Img(), 3
  956. LoadColorBob "!0000005.GFX", Img(), 4
  957. LoadColorBob "!0000006.GFX", Img(), 5
  958. LoadColorBob "!0000007.GFX", Img(), 6
  959.  
  960. LoadColorBob "!0000008.GFX", Img(), 7
  961. LoadColorBob "!0000009.GFX", Img(), 8
  962. LoadColorBob "!0000010.GFX", Img(), 9
  963. LoadColorBob "!0000011.GFX", Img(), 10
  964. LoadColorBob "!0000012.GFX", Img(), 11
  965. LoadColorBob "!0000013.GFX", Img(), 12
  966. LoadColorBob "!0000014.GFX", Img(), 13
  967. LoadColorBob "!0000015.GFX", Img(), 14
  968.  
  969. FOR n = 15 TO 29
  970.   FOR x = 1 TO 15
  971.     FOR y = 1 TO 15
  972.       Img(x, y, n) = Img(x, y, 15 - (n - 15))
  973.     NEXT
  974.   NEXT
  975. NEXT
  976.  
  977. n = 1
  978. FOR y = 1 TO 15
  979.   FOR x = 1 TO 15
  980.     PSET (x, y), n
  981.     n = n + 1
  982.   NEXT x
  983. NEXT y
  984.  
  985. DIM Temp(5000)
  986. GET (1, 1)-(15, 15), Temp
  987.  
  988. CLS
  989.  
  990. FOR y = 0 TO 12
  991.   FOR x = 0 TO 20
  992.     PUT (x * 15 + 3, y * 15 + 3), Temp, PSET
  993.   NEXT x
  994. NEXT y
  995.  
  996. xn = 1
  997. yn = 1
  998.  
  999. rs = 1
  1000. bs = 2
  1001. gs = 3
  1002.  
  1003. xp = 1
  1004.  
  1005. LOCATE 25, 1
  1006. PRINT SPACE$(40);
  1007.  
  1008. DO
  1009.  
  1010.   IF ballistic THEN
  1011.     xn = (xn - yn) MOD 15
  1012.     yn = (yn + xn) MOD 15
  1013.     xn = xn + RND + 315
  1014.     yn = yn + RND + 315
  1015.     xn = xn MOD 15
  1016.     yn = yn MOD 15
  1017.   ELSE
  1018.     deg = (deg + 2) MOD 360
  1019.     xn = SIN(deg / 55) * 15 + 15
  1020.     yn = COS(deg / 55) * 15 + 15
  1021.   END IF
  1022.  
  1023.   IF supercolor THEN
  1024.     r = r + rs
  1025.     g = g + gs
  1026.     b = b + bs
  1027.     IF r = 60 OR r = 0 THEN
  1028.       rs = -rs
  1029.     END IF
  1030.     IF g = 61 OR g = 0 THEN
  1031.       gs = -gs
  1032.     END IF
  1033.     IF b = 62 OR b = 0 THEN
  1034.       bs = -bs
  1035.     END IF
  1036.   END IF
  1037.  
  1038.   OUT &H3C8, 1
  1039.   FOR x = 1 TO 16
  1040.     xa = (xn + x) MOD 15
  1041.     FOR y = 1 TO 15
  1042.       ya = (yn + y) MOD 15
  1043.  
  1044.       IF Img(xa, ya, ip) THEN
  1045.         nr = Img(xa, ya, ip) + r
  1046.         ng = Img(xa, ya, ip) + g
  1047.         nb = Img(xa, ya, ip) + b
  1048.       ELSE
  1049.         nr = Img(xa, ya, ip)
  1050.         ng = Img(xa, ya, ip)
  1051.         nb = Img(xa, ya, ip)
  1052.       END IF
  1053.  
  1054.       OUT &H3C9, nr
  1055.       OUT &H3C9, ng
  1056.       OUT &H3C9, nb
  1057.     NEXT
  1058.   NEXT
  1059.  
  1060.   IF sp \ 8 > 904 THEN
  1061.     supercolor = 1
  1062.   END IF
  1063.  
  1064.   IF sp \ 8 > 1340 THEN
  1065.     ballistic = 1
  1066.   END IF
  1067.  
  1068.   ip = (ip + 1) MOD 30
  1069.  
  1070. LOOP UNTIL LEN(INKEY$)
  1071.  
  1072. REDIM Img(0, 0, 0)
  1073.  
  1074. END SUB
  1075.  
  1076. SUB ColorBobical2
  1077.  
  1078. CLS
  1079.  
  1080. SCREEN 13
  1081.  
  1082. OUT &H3C8, 0
  1083. FOR n = 1 TO 63
  1084.   OUT &H3C9, n
  1085.   OUT &H3C9, n
  1086.   OUT &H3C9, n
  1087. NEXT n
  1088.  
  1089. DIM Stars(1 TO 200) AS StarType
  1090. DIM Stars1(1 TO 200) AS StarType
  1091. DIM Stars2(1 TO 200) AS StarType
  1092. DIM Stars3(1 TO 200) AS StarType
  1093. DIM OldStars(1 TO 200) AS StarType
  1094.  
  1095. FOR n = 1 TO 200
  1096.  
  1097.   Stars1(n).Angle = RND * 360
  1098.   Stars1(n).Speed = RND * 3 + 1
  1099.   Stars1(n).Brite = RND * 10
  1100.   Stars1(n).Dis = RND * 200
  1101.  
  1102.   Stars2(n).Angle = (n * 3.6) MOD 360
  1103.   Stars2(n).Speed = 2
  1104.   Stars2(n).Brite = 1
  1105.   Stars2(n).Dis = (n * 25) MOD 200
  1106.  
  1107.   IF n MOD 3 = 0 THEN
  1108.     Stars3(n).Angle = (n * 3.6) MOD 360
  1109.     Stars3(n).Speed = 3
  1110.     Stars3(n).Brite = 1
  1111.     Stars3(n).Dis = n
  1112.   ELSEIF n MOD 3 = 1 THEN
  1113.     Stars3(n).Angle = ((n + 33) * 3.6) MOD 360
  1114.     Stars3(n).Speed = 3
  1115.     Stars3(n).Brite = 1
  1116.     Stars3(n).Dis = n
  1117.   ELSEIF n MOD 3 = 2 THEN
  1118.     Stars3(n).Angle = ((n + 66) * 3.6) MOD 360
  1119.     Stars3(n).Speed = 3
  1120.     Stars3(n).Brite = 1
  1121.     Stars3(n).Dis = n
  1122.   END IF
  1123.  
  1124. NEXT n
  1125.  
  1126. DIM S(360) AS INTEGER
  1127. DIM C(360) AS INTEGER
  1128.  
  1129. FOR n = 0 TO 360
  1130.   S(n) = SIN(n / 57.32) * 100 * 1.2
  1131.   C(n) = COS(n / 57.32) * 100
  1132. NEXT n
  1133.  
  1134. CLS
  1135.  
  1136. REDIM Temp(5000)
  1137.  
  1138. FOR n = 1 TO 200
  1139.   Stars(n).Angle = Stars1(n).Angle
  1140.   Stars(n).Speed = Stars1(n).Speed
  1141.   Stars(n).Brite = Stars1(n).Brite
  1142.   Stars(n).Dis = Stars1(n).Dis
  1143. NEXT n
  1144.  
  1145. DO
  1146.   d = (d + 1) MOD 360
  1147.   'star.trans.x(n) = (cosine(star.angle(n))) - (sine(star.angle(n))) * star.dis(n)
  1148.   'star.trans.y(n) = (sine(star.angle(n))) + (cosine(star.angle(n))) * star.dis(n)
  1149.   FOR n = 1 TO 200
  1150.     Stars(n).RealX = 160 + (C(Stars(n).Angle) - S(Stars(n).Angle) *_
  1151.  Stars(n).Dis) \ 100
  1152.     Stars(n).RealY = 100 + (S(Stars(n).Angle) + C(Stars(n).Angle) *_
  1153.  Stars(n).Dis) \ 100
  1154.     IF Stars(n).RealY < 11 THEN Stars(n).RealY = 200
  1155.   NEXT n
  1156.   FOR n = 1 TO 200
  1157.     PSET (OldStars(n).RealX, OldStars(n).RealY), 0
  1158.     PSET (Stars(n).RealX, Stars(n).RealY), Stars(n).Brite + Stars(n)_
  1159. .Dis \ 3
  1160.     OldStars(n).RealX = Stars(n).RealX
  1161.     OldStars(n).RealY = Stars(n).RealY
  1162.   NEXT n
  1163.   IF rotation <> 0 THEN
  1164.     FOR n = 1 TO 200
  1165.       Stars(n).Dis = (Stars(n).Dis + Stars(n).Speed) MOD 200
  1166.       Stars(n).Angle = (Stars(n).Angle + rotation) MOD 360
  1167.     NEXT n
  1168.   ELSE
  1169.     FOR n = 1 TO 200
  1170.       Stars(n).Dis = (Stars(n).Dis + Stars(n).Speed) MOD 200
  1171.     NEXT n
  1172.   END IF
  1173.   sp = sp + 1
  1174.  
  1175.   OUT &H3C8, 70
  1176.   OUT &H3C9, (1 * sp) MOD 40 + 20
  1177.   OUT &H3C9, (2 * sp) MOD 40 + 20
  1178.   OUT &H3C9, (3 * sp) MOD 40 + 20
  1179.  
  1180.   IF sp \ 8 = 122 THEN
  1181.     rotation = 1
  1182.   END IF
  1183.  
  1184.   IF sp \ 8 = 256 THEN
  1185.     rotation = 358
  1186.   END IF
  1187.  
  1188.   IF sp \ 8 = 512 THEN
  1189.     rotation = 0
  1190.     FOR n = 1 TO 200
  1191.       Stars(n).Angle = Stars2(n).Angle
  1192.       Stars(n).Speed = Stars2(n).Speed
  1193.       Stars(n).Brite = Stars2(n).Brite
  1194.       Stars(n).Dis = Stars2(n).Dis
  1195.     NEXT n
  1196.   END IF
  1197.  
  1198.   IF sp \ 8 = 762 THEN
  1199.     rotation = 1
  1200.   END IF
  1201.  
  1202.   IF sp \ 8 = 1024 THEN
  1203.     rotation = 358
  1204.   END IF
  1205.  
  1206.   IF sp \ 8 = 1256 THEN
  1207.     rotation = 0
  1208.  
  1209.     FOR n = 1 TO 200
  1210.       Stars(n).Angle = Stars3(n).Angle
  1211.       Stars(n).Speed = Stars3(n).Speed
  1212.       Stars(n).Brite = Stars3(n).Brite
  1213.       Stars(n).Dis = Stars3(n).Dis
  1214.     NEXT n
  1215.   END IF
  1216.  
  1217.   IF sp \ 8 = 1512 THEN
  1218.     rotation = 1
  1219.   END IF
  1220.  
  1221.   IF sp \ 8 = 1974 THEN
  1222.     rotation = 358
  1223.   END IF
  1224.  
  1225. LOOP UNTIL LEN(INKEY$)
  1226.  
  1227. REDIM Stars1(0) AS StarType
  1228. REDIM Stars2(0) AS StarType
  1229. REDIM Stars3(0) AS StarType
  1230.  
  1231. REDIM Stars(0) AS StarType
  1232. REDIM OldStars(0) AS StarType
  1233.  
  1234. END SUB
  1235.  
  1236. SUB ColorBobical3
  1237.  
  1238. SHARED ip
  1239. SHARED r
  1240. SHARED g
  1241. SHARED b
  1242.  
  1243. DIM ra(4): DIM ga(4): DIM ba(4)
  1244.  
  1245. ra(1) = 30: ga(1) = 10: ba(1) = 10
  1246. ra(2) = 10: ga(2) = 30: ba(2) = 10
  1247. ra(3) = 10: ga(3) = 10: ba(3) = 30
  1248. ra(4) = 30: ga(4) = 10: ba(4) = 30
  1249.  
  1250. ON TIMER(2) GOSUB SIP
  1251.  
  1252. OUT &H3C8, 0
  1253. FOR n = 0 TO 255
  1254.   OUT &H3C9, 0
  1255.   OUT &H3C9, 0
  1256.   OUT &H3C9, 0
  1257. NEXT n
  1258.  
  1259. DEF SEG = &HA000
  1260. BLOAD "SURPRISE.PIC", 0
  1261. DEF SEG
  1262.  
  1263. els = 1
  1264.  
  1265. TIMER ON
  1266.  
  1267. DIM Img(15, 15, 4)
  1268.  
  1269. LoadColorBob "FORM0001.GFX", Img(), 0
  1270. LoadColorBob "FORM0002.GFX", Img(), 1
  1271. LoadColorBob "FORM0003.GFX", Img(), 2
  1272. LoadColorBob "FORM0004.GFX", Img(), 3
  1273. LoadColorBob "FORM0005.GFX", Img(), 4
  1274.  
  1275. DO
  1276.   r = ra(ip)
  1277.   g = ga(ip)
  1278.   b = ba(ip)
  1279.   xn = xn + 1
  1280.   yn = yn + 1
  1281.   el = el + els
  1282.   IF el > 40 THEN
  1283.     els = -els
  1284.   ELSEIF el < 1 THEN
  1285.     els = -els
  1286.   END IF
  1287.   OUT &H3C8, 0
  1288.   OUT &H3C9, el
  1289.   OUT &H3C9, 0
  1290.   OUT &H3C9, 0
  1291.  
  1292.   FOR x = 1 TO 15
  1293.     xa = (xn + x) MOD 15
  1294.     FOR y = 1 TO 15
  1295.       ya = (yn + y) MOD 15
  1296.       IF Img(xa, ya, ip) THEN
  1297.         nr = Img(xa, ya, ip) + r
  1298.         ng = Img(xa, ya, ip) + g
  1299.         nb = Img(xa, ya, ip) + b
  1300.       ELSE
  1301.         nr = Img(xa, ya, ip) + el
  1302.         ng = Img(xa, ya, ip)
  1303.         nb = Img(xa, ya, ip)
  1304.       END IF
  1305.       OUT &H3C9, nr
  1306.       OUT &H3C9, ng
  1307.       OUT &H3C9, nb
  1308.     NEXT
  1309.   NEXT
  1310. LOOP UNTIL LEN(INKEY$)
  1311.  
  1312. END SUB
  1313.  
  1314. SUB LoadColorBob (ImgFile$, Img(), ImgExt)
  1315.  
  1316. OPEN ImgFile$ FOR BINARY AS #1
  1317. a$ = INPUT$(2, 1)
  1318. FOR y = 1 TO 15
  1319.   FOR x = 1 TO 15
  1320.     Img(x, y, ImgExt) = ASC(INPUT$(1, 1))
  1321.   NEXT
  1322. NEXT
  1323. CLOSE #1
  1324.  
  1325. END SUB
  1326.  
  1327. SUB Welcome
  1328.  
  1329. SCREEN 0
  1330. WIDTH 80
  1331.  
  1332. COLOR 15, 1
  1333. CLS
  1334.  
  1335. CLS
  1336. PRINT "Hello, and welcome to my demo! It's pretty simple but it's fun to watch"
  1337. PRINT "in some parts. Anyways, there's no scrolls or anything, although there"
  1338. PRINT "*was*, once apon a time... (I removed them because they slowed things"
  1339. PRINT "down WAAY too much). There are three parts to the demo:"
  1340. PRINT ""
  1341. PRINT "   i) Li'l bouncing colorbobs. Just watch it until the movement starts to"
  1342. PRINT "      go 'ballistic', that is, the balls jump around EVERYWHERE."
  1343. PRINT "  ii) Starfield. Just watch it until you witness 8 changes."
  1344. PRINT " iii) Surprise! Watch it for 10 seconds or so..."
  1345. PRINT ""
  1346. PRINT "Bye! Calvin French (1:134/75)";
  1347. DO: LOOP UNTIL LEN(INKEY$)
  1348. CLS
  1349. PRINT "Okay let's go..."
  1350. END SUB
  1351.  
  1352.  
  1353.  
  1354. Msg #:  2614                      QUIKBAS Subboard
  1355.  From:  SCOTT BAILEY              Sent: 12-05-93 23:28
  1356.    To:  AVERY ANTHONY             Rcvd: -NO-
  1357.    Re:  MOUSE IN QBASIC
  1358.  
  1359. You can use the mouse in Qbasic 1.X with this:
  1360.  
  1361. '---cut-here---
  1362. DEFINT A-Z
  1363. SCREEN 12
  1364. CLS
  1365.  
  1366. DEF SEG = 0
  1367. getseg = 256 * PEEK(207) + PEEK(206)
  1368. mousestuff = 256 * PEEK(205) + PEEK(204) + 2
  1369.  
  1370. DEF SEG = getseg
  1371.  
  1372. IF (getseg OR (mousestuff - 2)) AND PEEK(mousestuff - 2) = 207 THEN
  1373.   SCREEN 0
  1374.   PRINT "Load your mouse driver!"
  1375.   END
  1376. END IF
  1377.  
  1378. 'Reset mouse driver
  1379. m1 = 0
  1380. CALL absolute(m1, m2, m3, m4, mousestuff)
  1381. COLOR 14
  1382.  
  1383. 'Turn pointer on
  1384. m1 = 1
  1385. CALL absolute(m1, m2, m3, m4, mousestuff)
  1386.  
  1387. DO
  1388.   m1 = 3
  1389.   CALL absolute(m1, m2, m3, m4, mousestuff)
  1390.   IF m2 = 1 THEN LOCATE 2, 1: PRINT "Left button pressed!!"
  1391.   IF m2 = 2 THEN LOCATE 2, 1: PRINT "Right button pressed!"
  1392.   LOCATE 3, 1: PRINT "Horizontal pos:"; m3
  1393.   LOCATE 4, 1: PRINT "Vertical pos:"; m4
  1394. LOOP UNTIL m2 = 3
  1395. PRINT "Both buttons pressed!"
  1396.  
  1397. 'Turn pointer off
  1398. m1 = 2
  1399. CALL absolute(m1, m2, m3, m4, mousestuff)
  1400.  
  1401.  
  1402.  
  1403. Msg #:  2694                      QUIKBAS Subboard
  1404.  From:  RAY CARSON                Sent: 12-08-93 09:13
  1405.    To:  JACK LEMIRE               Rcvd: -NO-
  1406.    Re:  SCROLL
  1407.  
  1408. Jack Lemire,
  1409.  
  1410. JL> I know how to scroll the screen UP and DOWN by using
  1411. JL> interrupts, but I can't find a way do make it scroll left
  1412. JL> and right like in Lotus 1-2-3, etc...
  1413. JL> If you know if it's possible, or how to do it, leave me a message
  1414.  
  1415. The following code is slow in the IDE but is reasonably fast when
  1416. compiled to an .EXE. You will lose characters that are scrolled off
  1417. of the screen unless you put them into an array or if you are working
  1418. with known data (arrays/fields) then just reprint. I Hope long lines
  1419. don't get wrapped!
  1420.  
  1421. DEFINT A-Z      'SCROLL.BAS ~ Ray Carson ~ 1993
  1422. DECLARE SUB Scroll (UpperRow, LowerRow, Columns, Direction)
  1423. COLOR 15, 1: CLS
  1424. LOCATE 4, 2: PRINT CHR$(218); STRING$(76, CHR$(196)); CHR$(191);
  1425. LOCATE 8, 2: PRINT CHR$(192); STRING$(76, CHR$(196)); CHR$(217);
  1426. FOR X = 5 TO 7
  1427.     LOCATE X, 2: PRINT CHR$(179);
  1428.     LOCATE X, 79: PRINT CHR$(179);
  1429. NEXT
  1430. COLOR 14, 1
  1431. LOCATE 5, 32: PRINT "RC Software";
  1432. LOCATE 6, 32: PRINT "1113 Hillcrest";
  1433. LOCATE 7, 32: PRINT "Conroe, Texas 77301";
  1434. COLOR 2, 1
  1435. LOCATE 6, 10: PRINT "(409)756-6860";
  1436. LOCATE 6, 60: PRINT "(409)441-5096";
  1437. COLOR 20, 1: LOCATE 10, 35: PRINT "Press Key";
  1438. DO: LOOP UNTIL LEN(INKEY$)
  1439. CALL Scroll(5, 6, 10, 0)  ' Direction 0 = right
  1440. DO: LOOP UNTIL LEN(INKEY$)
  1441. CALL Scroll(5, 6, 10, -1) ' Direction -1 = left
  1442. COLOR 15, 1: LOCATE 10, 35: PRINT "  Done   ";
  1443.  
  1444. SUB Scroll (UpperRow, LowerRow, Columns, Direction)
  1445.  
  1446.     DEF SEG = 0
  1447.     Address = PEEK(1040) AND 48
  1448.     IF Address = 48 THEN
  1449.         DEF SEG = &HB000    'mono
  1450.     ELSE
  1451.         DEF SEG = &HB800    'color
  1452.     END IF
  1453.     FOR X = 1 TO Columns
  1454.         IF Direction = 0 THEN               'Right
  1455.             FOR Column = 79 TO 1 STEP -1    'move everything
  1456.                 FOR Row = UpperRow TO LowerRow
  1457.                     Offset = ((Row - 1) * 80 + (Column - 1)) * 2
  1458.                     NewColumn = Column + 1
  1459.                     NewOffset = ((Row - 1) * 80 + (NewColumn - 1)) * 2
  1460.                     Char = PEEK(Offset)
  1461.                     Attr = PEEK(Offset + 1)
  1462.                     POKE NewOffset, Char
  1463.                     POKE NewOffset + 1, Attr
  1464.                     POKE Offset, 32
  1465.                 NEXT
  1466.             NEXT
  1467.         END IF
  1468.         IF Direction = -1 THEN              'Left
  1469.             FOR Column = 2 TO 80            'move everything
  1470.                 FOR Row = UpperRow TO LowerRow
  1471.                     Offset = ((Row - 1) * 80 + (Column - 1)) * 2
  1472.                     NewColumn = Column - 1
  1473.                     NewOffset = ((Row - 1) * 80 + (NewColumn - 1)) * 2
  1474.                     Char = PEEK(Offset)
  1475.                     Attr = PEEK(Offset + 1)
  1476.                     POKE NewOffset, Char
  1477.                     POKE NewOffset + 1, Attr
  1478.                     POKE Offset, 32
  1479.                 NEXT
  1480.             NEXT
  1481.         END IF
  1482.     NEXT
  1483.  
  1484. END SUB
  1485.  
  1486.  
  1487.  
  1488. Msg #:  3392                      QUIKBAS Subboard
  1489.  From:  MARK BUTLER               Sent: 12-22-93 23:25
  1490.    To:  HOWARD HULL JR            Rcvd: -NO-
  1491.    Re:  FILE VIEWER AND LISTING
  1492.  
  1493. Once upon a time Howard Hull Jr uttered this mournful cry to All:
  1494.  
  1495.  HHJ>   AAGGRHHH,
  1496.         ^^^^^^^^
  1497.  You took the word out of my mouth. I'm over 42 and married with
  1498. children 
  1499.  ...I couldn't have said it better <Al Bundy type grin>
  1500.  
  1501.  HHJ> Does anyone have any simple source code for reading
  1502.  HHJ> and viewing a  file.  I have seen several Freeware
  1503.  HHJ> and Shareware file viewers,  but would like to
  1504.  HHJ> incorporate one into my program.   
  1505.  
  1506.  Here's a little something I was playing around with some time back. I 
  1507.  never quite finished it to my satisfaction but you're free to use it, 
  1508.  abuse it or refuse it, do anything you wish to do with it.... 
  1509.  
  1510. ==========================8< Cut Here 8<=============================
  1511.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&THEN?" :) Ok!"ELSE?" :( Bad!
  1558. SUB U(A$):FOR A=1TO LEN(A$):C=ASC(MID$(A$,A))-37:IF C<0THEN C=91+C*32
  1559. IF K<4THEN K=C+243ELSE?#1,CHR$(C+(K MOD 3)*86);:K=K\3:B&=B&+1
  1560. S=(S+C)AND 255:NEXT:LOCATE,1:?STRING$(B&*50\Z&,219);:END SUB
  1561. '>>> Page 1 of VIEW.ZIP ends here. Last page. TCHK:55
  1562.  
  1563.  
  1564. Buffer.Attributes
  1565.         Buffer.FileName = STRING$(13, 32)
  1566.         RETURN
  1567.  
  1568.  END SUB
  1569.  
  1570.  
  1571.  
  1572.  
  1573. Msg #:  3571                      QUIKBAS Subboard
  1574.  From:  VICTOR ELLIOTT            Sent: 12-29-93 11:28
  1575.    To:  DONALD SCHELLE            Rcvd: -NO-
  1576.    Re:  DIRECTORY --> ARRAY, 1/2
  1577.  
  1578. This code (with some small modifications) should assemble all directory
  1579. information into one array...  You probibly want one for the size, one
  1580. for the date, etc.
  1581.  
  1582. Modify it near the end where it assembles the array...  I got it to
  1583. work the other day, but didn't save a modified copy by itself...
  1584.  
  1585. //Vic
  1586.  
  1587. -----------------------------
  1588. QB4.5 CODE 1/2 FOLLOWS
  1589. -----------------------------
  1590. 'FULLDIR.BAS by Gaylon Hill
  1591. '
  1592. 'CALL FullDir(Dir$(), DirNum, FileDir, Path$, WildCard$)
  1593. 'Dir$()     - is filled with the directory file names, size, date, & time.
  1594. 'Dirnum     - returns the number of Dir$() (arrays).
  1595. 'FileDir    - if FileDir = 1 then sub-directories names are returned,also.
  1596. 'Path$      - if Path$= "" then the default path is used. Please note,
  1597. '             if the Path$ is given then the wildcard will have to be
  1598. '             given with the path name.
  1599. '             Ex: Path$ = "\MAIN\QB\*.BAS" or Path$ = "A:\*.*"
  1600. 'WildCard$  - the WildCard$ selects the type of file needed. Use ? or *
  1601. '             to narrow the file selection. If WildCard$ = "" then the
  1602. '             default is "*.*". This entry has NO EFFECT when the Path$
  1603. '             is given.
  1604.  
  1605. TYPE FileFindBuf
  1606.         DOS            AS STRING * 19
  1607.         CreateTime     AS STRING * 1
  1608.         Attributes     AS INTEGER
  1609.         AccessTime     AS INTEGER
  1610.         AccessDate     AS INTEGER
  1611.         FileSize       AS LONG
  1612.         FileName       AS STRING * 13
  1613. END TYPE
  1614.  
  1615. TYPE Register
  1616.         ax    AS INTEGER
  1617.         bx    AS INTEGER
  1618.         cx    AS INTEGER
  1619.         dx    AS INTEGER
  1620.         bp    AS INTEGER
  1621.         si    AS INTEGER
  1622.         di    AS INTEGER
  1623.         flags AS INTEGER
  1624.         ds    AS INTEGER
  1625.         es    AS INTEGER
  1626. END TYPE
  1627.  
  1628. DEFINT A-Z
  1629. '
  1630. SUB FullDir (Dir$(), DirNum, FileDir, path$, WildCard$)
  1631.  
  1632.         DIM inreg AS Register, outreg AS Register
  1633.         DIM Buffer AS FileFindBuf
  1634.  
  1635.         DirNum = 0
  1636.  
  1637.         IF WildCard$ = "" THEN
  1638.                 WildCard$ = "*.*"
  1639.         END IF
  1640.  
  1641.         IF path$ = "" THEN
  1642. ' Get Current Drive
  1643.  
  1644.                 inreg.ax = &H1900
  1645.                 CALL Interrupt(&H21, inreg, inreg)
  1646.                 Drive$ = CHR$(65 + inreg.ax MOD 256)
  1647. ' Get Current Path
  1648.                 DIM PathSize AS STRING * 64
  1649.                 inreg.ax = &H4700
  1650.                 inreg.dx = ASC(Drive$) - 64
  1651.                 inreg.ds = VARSEG(PathSize)
  1652.                 inreg.si = VARPTR(PathSize)
  1653.                 CALL InterruptX(&H21, inreg, inreg)
  1654.                 path$ = LEFT$(PathSize, INSTR(PathSize, CHR$(0)) - 1)
  1655.                 path$ = Drive$ + ":\" + path$ + "\" + WildCard$
  1656.         END IF
  1657. 'Set the area where the file information will be stored
  1658.         inreg.ax = &H1A00
  1659.         inreg.ds = VARSEG(Buffer)
  1660.         inreg.dx = VARPTR(Buffer)
  1661.         CALL Interrupt(&H21, inreg, outreg)
  1662. ' Find the first file, if FirstFM=0 then continue.
  1663.         inreg.ax = &H4E00
  1664.         inreg.cx = 62
  1665.         NPath$ = path$ + CHR$(0)
  1666.         inreg.dx = SADD(NPath$)
  1667.         CALL Interrupt(&H21, inreg, outreg)
  1668.         FirstFM = (outreg.ax AND &HF)
  1669. 'Find the next file(s), if NextFM<>0 then exit.
  1670.         IF FirstFM = 0 THEN
  1671.                 GOSUB MakeFile
  1672.                 DO
  1673.                         inreg.ax = &H4F00
  1674.                         inreg.dx = SADD(NPath$)
  1675.                         CALL Interrupt(&H21, inreg, outreg)
  1676.                         NextFM = outreg.ax AND &HF
  1677.                         IF NextFM = 0 THEN
  1678.                                 GOSUB MakeFile
  1679.                         END IF
  1680.                 LOOP WHILE NextFM = 0
  1681.         END IF
  1682.         EXIT SUB
  1683. MakeFile:
  1684.         IF LEFT$(Buffer.FileName, 1) = "." THEN
  1685.                 RETURN
  1686.         END IF
  1687.  
  1688.         FSize$ = RIGHT$(SPACE$(8) + STR$(Buffer.FileSize), 8)
  1689.  
  1690.         BitT = Buffer.AccessTime
  1691.         ahr = 0
  1692.         IF BitT < 0 THEN BitT = 32767 + BitT: ahr = 16
  1693.         hr = (BitT \ 2048)
  1694.         mm = (BitT - (hr * 2048)) \ 32
  1695.         hr = ahr + hr
  1696.         FTime$ = RIGHT$("00" + LTRIM$(STR$(hr)), 2) + ":" +
  1697. RIGHT$("00"+ LTRIM$(STR$(mm)), 2)
  1698.  
  1699.         BitD = Buffer.AccessDate
  1700.         yr = BitD \ 512
  1701.         mo = (BitD - (yr * 512)) \ 32
  1702.         da = BitD - (yr * 512) - (mo * 32)
  1703.         FDate$ = RIGHT$("0" + LTRIM$(STR$(mo)), 2) + "-" + RIGHT$("0"+LTRIM$(STR$(da)), 2) + "-" + LTRIM$(STR$(80 + yr))
  1704.  
  1705.         x = INSTR(Buffer.FileName, ".")
  1706.         IF x = 0 THEN
  1707.                 FileTemp$ = LEFT$(Buffer.FileName + STRING$(12, 32),12)
  1708.         ELSE
  1709.                 FileTemp$ = LEFT$(LEFT$(Buffer.FileName, x - 1) +SPACE$(12), 8) + MID$(Buffer.FileName, x, 4)
  1710.         END IF
  1711.  
  1712.         IF Buffer.Attributes = 4096 AND FileDir = 1 THEN
  1713.                 FileTemp$ = MID$(Buffer.FileName, 1, 12)
  1714.         END IF
  1715.  
  1716.         DirNum = DirNum + 1
  1717.         Dir$(DirNum) = FileTemp$ + FSize$ + "  " + FDate$ + "  " +FTime$
  1718.  
  1719.         IF Buffer.Attributes = 4096 AND FileDir = 1 THEN
  1720.                 MID$(Dir$(DirNum), 13, 9) = "<dir>    "
  1721.         END IF
  1722.  
  1723.         Buffer.Attributes = 0
  1724.         Buffer.AccessTime = 0
  1725.         Buffer.AccessDate = 0
  1726.         Buffer.FileSize = 0
  1727.         Buffer.FileName = STRING$(13, 32)
  1728.         RETURN
  1729. END SUB
  1730.  
  1731.  
  1732.  
  1733.  
  1734.  
  1735. Msg #:  3647                      QUIKBAS Subboard
  1736.  From:  RICHARD VANNOY            Sent: 12-30-93 18:42
  1737.    To:  VICTOR ELLIOTT            Rcvd: -NO-
  1738.    Re:  .WORKING CODE. FINALLY! 1
  1739.  
  1740. VE> //Vic
  1741. VE> QB4.5 CODE 1/2 FOLLOWS
  1742. VE> 'FULLDIR.BAS by Gaylon Hill
  1743.  
  1744. I couldn't get your code to work.  Yesterday, I finally
  1745. decided I absolutely MUST have working "Get all the files in
  1746. a DIR" code, so I sat down with 35 (!!) different samples of
  1747. code from this and other echoes.  After many hours of
  1748. frustration and bug chasing, I finally found TWO samples
  1749. that actually worked!  The one I liked best was posted here
  1750. (I think) as FILINFO1.BAS, author unknown.  I'll post it
  1751. again for those that would like it.
  1752. 'FILINFO1.BAS
  1753. 'Load PDS with    QBX /L
  1754. DECLARE SUB SetDTA (Segment%, Offset%)
  1755. DEFINT A-Z
  1756.  
  1757. TYPE RegTypeX
  1758.      ax    AS INTEGER
  1759.      bx    AS INTEGER
  1760.      cx    AS INTEGER
  1761.      dx    AS INTEGER
  1762.      bp    AS INTEGER
  1763.      si    AS INTEGER
  1764.      di    AS INTEGER
  1765.      flags AS INTEGER
  1766.      ds    AS INTEGER
  1767.      es    AS INTEGER
  1768. END TYPE
  1769. DECLARE SUB InterruptX (intnum AS INTEGER, reg AS RegTypeX, reg AS RegTypeX)
  1770.  
  1771. TYPE FileType
  1772.     Trackinfo AS STRING * 21
  1773.     Attribute AS STRING * 1
  1774.     FileTime  AS INTEGER
  1775.     FileDate  AS INTEGER
  1776.     Filesize  AS LONG
  1777.     FileName  AS STRING * 13
  1778. END TYPE
  1779.  
  1780. DIM KeyStroke AS STRING, FileName AS STRING, FileInfo AS FileType
  1781. DIM SHARED Regs AS RegTypeX
  1782.  
  1783. COLOR 7, 0
  1784. CLS
  1785.  
  1786. FileName = SPACE$(66)
  1787. Col = 1
  1788. LOCATE 1, 1, 1, 12, 13
  1789. PRINT "Type the name of the file you want information on."
  1790.  
  1791. DO
  1792.     LOCATE 2, Col
  1793.  
  1794.     WHILE LEN(INKEY$): WEND
  1795.     DO
  1796.         KeyStroke = INKEY$
  1797.     LOOP UNTIL LEN(KeyStroke) = 1
  1798.  
  1799.     AscKey = ASC(KeyStroke)
  1800.     SELECT CASE AscKey
  1801.         CASE 27  'ESC
  1802.             CLS
  1803.             END
  1804.  
  1805.         CASE 13
  1806.             '--- Create a ASCIIZ string
  1807.             FileName = RTRIM$(FileName) + CHR$(0)
  1808.             LOCATE 4, 1
  1809.             EXIT DO
  1810.  
  1811.         CASE 8    'BackSpace
  1812.             IF Col > 1 THEN
  1813.                 Col = Col - 1
  1814.                 MID$(FileName, 1) = LEFT$(FileName, Col) + SPACE$(1)
  1815.                 LOCATE 2, Col
  1816.                 PRINT " ";
  1817.             END IF
  1818.  
  1819.         CASE IS > 31
  1820.             IF Col < 66 THEN
  1821.                 MID$(FileName, Col) = KeyStroke
  1822.                 PRINT KeyStroke;
  1823.                 Col = Col + 1
  1824.             END IF
  1825.     END SELECT
  1826. LOOP
  1827.  
  1828.  
  1829. Regs.ax = &H2F00
  1830. CALL InterruptX(&H21, Regs, Regs)
  1831. DTASeg = Regs.es
  1832. DTAOff = Regs.bx
  1833.  
  1834. '--- Set the DTA to our record
  1835. SetDTA VARSEG(FileInfo), VARPTR(FileInfo)
  1836.  
  1837. '--- Attempt to find a match for the filespec
  1838. Regs.ax = &H4E00
  1839. Regs.cx = 55
  1840. 'Note:  If you are using QB you must replace SSEG with VARSEG
  1841. 'Regs.ds = VARSEG(FileName)
  1842. Regs.ds = SSEG(FileName)
  1843. Regs.dx = SADD(FileName)
  1844.  
  1845. CALL InterruptX(&H21, Regs, Regs)
  1846. IF Regs.flags AND 1 THEN GOTO DiskError
  1847.  
  1848. NumberFound = 1
  1849. DO
  1850.     EndOfFileName = INSTR(FileInfo.FileName, CHR$(0)) - 1
  1851.     PRINT LEFT$(FileInfo.FileName, EndOfFileName); " is ";
  1852.     Attribute = ASC(FileInfo.Attribute)
  1853.     FOR Counter = 1 TO 5
  1854.         SELECT CASE Counter
  1855.             CASE 1
  1856.                 IF Attribute AND 1 THEN PRINT "RO ";
  1857.             CASE 2
  1858.                 IF Attribute AND 2 THEN PRINT "H ";
  1859.             CASE 3
  1860.                 IF Attribute AND 4 THEN PRINT "S ";
  1861.             CASE 4
  1862.                 IF Attribute AND 16 THEN PRINT "A Subdirectory ";
  1863.             CASE 5
  1864.                 IF Attribute AND 32 THEN PRINT "A ";
  1865.         END SELECT
  1866.     NEXT Counter
  1867.  
  1868.     '--- Show the time
  1869.     PRINT
  1870.     PRINT "It was created at";
  1871.     PRINT STR$(ABS((FileInfo.FileTime AND &HF800) \ 2048));        'Hours
  1872.     PRINT ":"; LTRIM$(STR$((FileInfo.FileTime AND &H7E0) \ 32));   'Minutes
  1873.     PRINT ":"; LTRIM$(STR$((FileInfo.FileTime AND &H1F) * 2));     'Seconds
  1874.  
  1875. 'FILINFO2.BAS
  1876.  
  1877.     '--- Show the date
  1878.     PRINT " on";
  1879.     '--- The month
  1880.     PRINT STR$((FileInfo.FileDate AND &H1E0) \ 32);
  1881.     '--- The day
  1882.     PRINT "/"; LTRIM$(STR$(FileInfo.FileDate AND &H1F));
  1883.     '--- The year
  1884.     PRINT "/"; LTRIM$(STR$(((FileInfo.FileDate AND &HFE00) \ 512) + 1980));
  1885.  
  1886.     '--- Show the size
  1887.     PRINT " and is"; FileInfo.Filesize; " bytes long."
  1888.     PRINT
  1889.  
  1890.     '--- Reset the DTA to our record in case it moved
  1891.     SetDTA VARSEG(FileInfo), VARPTR(FileInfo)
  1892.  
  1893.     '--- Try to find another file
  1894.     Regs.ax = &H4F00
  1895.     CALL InterruptX(&H21, Regs, Regs)
  1896.  
  1897.     IF Regs.flags AND 1 THEN GOTO DiskError
  1898.  
  1899.     NumberFound = NumberFound + 1
  1900.     IF NumberFound = 8 THEN
  1901.         PRINT "- More -";
  1902.         WHILE LEN(INKEY$): WEND
  1903.         DO: LOOP UNTIL LEN(INKEY$)
  1904.         NumberFound = 0
  1905.         PRINT
  1906.     END IF
  1907. LOOP
  1908.  
  1909. '--- All things being equal, and all roads leading to Rome, the only way out
  1910. '    of this program once it is searching, is to come through here.
  1911. DiskError:
  1912.     SELECT CASE Regs.ax
  1913.         CASE &H2
  1914.             PRINT "File not found"
  1915.         CASE &H3
  1916.             PRINT "Invalid path"
  1917.         CASE &H12
  1918.             PRINT "No more files"
  1919.     END SELECT
  1920.  
  1921.     '--- In this case, this is pointless, however in a real-world app, other
  1922.     '    processes may be using a DTA of their own, so it is good practice to
  1923.     '    set the DTA back to what it was when we changed it.
  1924.  
  1925.     SetDTA DTASeg, DTAOff
  1926. END
  1927.  
  1928. SUB SetDTA (Segment, Offset)
  1929. Regs.ax = &H1A00
  1930. Regs.ds = Segment
  1931. Regs.dx = Offset
  1932. CALL interrupt(&H21, Regs, Regs)
  1933. END SUB
  1934.  
  1935.  
  1936.  
  1937.  
  1938.  
  1939.  
  1940. Msg #:  3739                      QUIKBAS Subboard
  1941.  From:  HARRY F. HARRISON         Sent: 12-30-93 09:49
  1942.    To:  JOHNNY LOUDAKIS           Rcvd: -NO-
  1943.    Re:  FILE ATRRIBUTES
  1944.  
  1945.  
  1946.  >   I'm needing to be able to turn off file attributes on the fly
  1947.  
  1948. Try this: (This is a solid, tested, and bug-free routine).
  1949.  
  1950. Valid bits for Attrib%
  1951. &H1 - Read Only
  1952. &H2 - Hidden
  1953. &H4 - System
  1954. &H8 - Volume label
  1955. &H10 - Sub Directory
  1956. &H20 - Archive
  1957. &H80 - Shareable (Novell Netware - used to set shareable flag)
  1958.  
  1959. 'USE the following code fragment as an example.
  1960.  
  1961. 'Get attributes of a file.
  1962. Attrib% = GetFileAttributes%("C:\IO.SYS")
  1963. IF Attrib% AND &H2 ' check for 'system' attribute set.
  1964.     Attrib% = Attrib% XOR &H2 'Turn it off.
  1965. ELSE  'not set
  1966.     Attrib% = Attrib% OR &H2  'Turn it on.
  1967. ENDIF
  1968.  
  1969. 'call interrupt to set attributes.
  1970. CALL SetFileAttributes("C:\IO.SYS", Attrib%)
  1971.  
  1972. DECLARE FUNCTION GetFileAttributes% (FileName$)
  1973. DECLARE SUB SetFileAttributes% (FileName$, Attribute%)
  1974. '$INCLUDE: '..\include\qbx.bi'
  1975.  
  1976. DEFINT A-Z
  1977. FUNCTION GetFileAttributes% (FileName$)
  1978.     DIM InRegs AS RegTypeX, OutRegs AS RegTypeX
  1979.     InRegs.ax = &H4300
  1980.     FileNameZ$ = LTRIM$(RTRIM$(FileName$)) + CHR$(0)
  1981.     InRegs.ds = SSEG(FileNameZ$)
  1982.     InRegs.dx = SADD(FileNameZ$)
  1983.     CALL InterruptX(&H21, InRegs, OutRegs)
  1984.     GetFileAttributes% = OutRegs.cx
  1985. END FUNCTION
  1986.  
  1987. SUB SetFileAttributes% (FileName$, Attribute%)
  1988.     DIM InRegs AS RegTypeX, OutRegs AS RegTypeX
  1989.     InRegs.ax = &H4301
  1990.     InRegs.cx = Attribute%
  1991.     FileNameZ$ = LTRIM$(RTRIM$(FileName$)) + CHR$(0)
  1992.     InRegs.ds = SSEG(FileNameZ$)
  1993.     InRegs.dx = SADD(FileNameZ$)
  1994.     CALL InterruptX(&H21, InRegs, OutRegs)
  1995. END SUB
  1996.  
  1997.  
  1998.  
  1999.  
  2000. Msg #:  3819                      QUIKBAS Subboard
  2001.  From:  MARK BUTLER               Sent: 01-04-94 02:01
  2002.    To:  ALL                       Rcvd: -NO-
  2003.    Re:  FIX THAT *$%! "FAST" SAVE
  2004.  
  2005. --> Note:
  2006. Forwarded (from: ILINK_BASIC) by Mark Butler using timEd.
  2007. Original was from Douglas Lusher to Mike Cocke.
  2008.  
  2009. MC>DL> Joe Pavorati (sp?) posted a patch for QB4.5 that will make ascii the
  2010. MC>DL> default save format instead of quick save/load. Did you get that?
  2011.  
  2012. MC>I didn't - do you still have it?  If so, could you please repost it.
  2013.  
  2014.               'Patch to by-pass "Fast Save/Load" Bug in QB 4.5
  2015.               ' by J. S. Paravati    12/93
  2016.  
  2017.  
  2018.   'Note!:  This program will modify a QB.EXE file! Backup your original
  2019.   '        file first!
  2020.  
  2021.   ' After modifacation takes place the "Fast Load and Save" will
  2022.   ' NO LONGER WORK.  No matter where you put the "dot" in the
  2023.   ' "Format" box (or ALT F S, or Mouse F then S), your programs will
  2024.   ' *ALWAYS* be saved in the ASCII
  2025.   ' (Text- Readable by Other Programs) format.
  2026.  
  2027.  DEFINT A-Z
  2028.  DEFLNG N
  2029.  
  2030.  CLS
  2031.  
  2032.  F$ = "C:\QB45\QB.EXE"
  2033.  F$ = UCASE$(F$)
  2034.  
  2035.  OPEN F$ FOR BINARY AS #1
  2036.  SK& = &HE9C5
  2037.  IF SK& < 0 THEN SK& = SK& + 65536 + 1
  2038.  
  2039.   SEEK #1, SK&
  2040.     GET #1, , AX: PRINT HEX$(AX), " Original Value Should = Hex 775"
  2041.  
  2042.    NewByte = 7 * 256 + &HEB
  2043.    SEEK #1, SK&
  2044.  PRINT HEX$(NewByte), " New Value Should = Hex 7EB"
  2045.  PRINT HEX$(SEEK(1)), " Address Should = E9C6"
  2046.  
  2047.  IF HEX$(AX) <> "775" OR HEX$(SEEK(1)) <> "E9C6" THEN
  2048.    PRINT
  2049.    PRINT "File Already Modified or Wrong Version: Quitting Program"
  2050.    CLOSE : END
  2051.  END IF
  2052.  
  2053.     PUT #1, , NewByte
  2054.  
  2055.   SEEK #1, SK&
  2056.   GET #1, , AX
  2057.   PRINT
  2058.   PRINT "File Modified. New Value at "; HEX$(SK&); " = "; HEX$(AX)
  2059.  
  2060.  CLOSE
  2061.  END
  2062.  
  2063.  
  2064.  
  2065.  
  2066.  
  2067. Msg #:  3895                      QUIKBAS Subboard
  2068.  From:  BRIAN MCLAUGHLIN          Sent: 01-05-94 10:49
  2069.    To:  ALL                       Rcvd: -NO-
  2070.    Re:  BIT-TWIDDLING ASM CODE
  2071.  
  2072. ;---------------------- START ASM CODE -------------------------------
  2073. comment | USE WITH QB/PDS.  Assemble with MASM 5.1 or better.
  2074.  
  2075. Written by Brian McLaughlin. Released into public domain 1/5/94.
  2076. This source code contains two integer FUNCTIONs: SetBit% and GetBit%.
  2077.  
  2078. SetBit accepts a target integer and a second paramenter naming the
  2079. target bit (0-15) to set or clear, and a third parameter showing
  2080. whether to set or to clear the target bit. To clear the target bit, the
  2081. third value should be zero. To set the target bit use any non-zero
  2082. value. Because SetBit is written as a FUNCTION, the original target
  2083. integer WILL NOT be altered, unless you reassign it, using the
  2084. value returned by SetBit, like so:
  2085.  
  2086.    Target% = SetBit%(Target%, 0, 0)    'sets bit 0 to 0 in Target%
  2087.  
  2088. NOTE: Bit position 0 is the furthest "righthand" bit in the Target%,
  2089. when it is written in binary notation.
  2090.  
  2091. GetBit accepts a target integer, and a second parameter that shows
  2092. which bit (0-15) to read. GetBit returns a zero if the bit is zero,
  2093. or -1 if the bit is 1. This lets you use IF NOT GetBit%...THEN.
  2094.  
  2095. IMPORTANT NOTE: Both these FUNCTIONs give erratic results when passed a
  2096. bit position other than 0 through 15.
  2097.  
  2098. DECLARE them:     DECLARE FUNCTION SetBit%(Target%, BitPos%, SetOrClr%)
  2099.                   DECLARE FUNCTION GetBit%(Target%, BitPos%)
  2100. end comment |
  2101.  
  2102. .MODEL MEDIUM, BASIC
  2103. .CODE
  2104.  
  2105. SetBit PROC FAR USES DI, Intgr:WORD, BitPos:WORD, SetIt:WORD
  2106.     Mov BX, Intgr    ;BX = address of the target integer
  2107.     Mov AX, [BX]     ;AX = value of target integer
  2108.     Mov BX, SetIt    ;BX = address of SetIt
  2109.     Mov DX, [BX]     ;DX = value of SetIt
  2110.     Mov BX, BitPos   ;BX = address of BitPos
  2111.     Mov CX, [BX]     ;CX = value of BitPos
  2112.     Mov DI, 1        ;set mask (DI) to 00000000 00000001b
  2113.     Shl DI, CL       ;DI holds the mask, shift it left CL times
  2114.     Cmp DX, 0        ;should the bit be cleared?
  2115.     Je  ClrBit       ;if so, then skip ahead
  2116.     Or  AX, DI       ;set bit to 1 by ORing with the mask
  2117.     Jmp SHORT Exit   ;and return
  2118. ClrBit:
  2119.     Not DI           ;to clear bit, reverse the mask
  2120.     And AX, DI       ;then AND the mask and the target integer
  2121. Exit:
  2122.     Ret              ;all done!
  2123. SetBit ENDP
  2124.  
  2125. GetBit PROC FAR USES DI, Intgr:WORD, BitPos:WORD
  2126.     Xor AX, AX       ;assume we're returning a zero in AX
  2127.     Mov BX, Intgr    ;BX = address of the target integer
  2128.     Mov DX, [BX]     ;DX = value of target integer
  2129.     Mov BX, BitPos   ;BX = address of BitPos
  2130.     Mov CX, [BX]     ;CX = value of BitPos
  2131.     Mov DI, 1        ;set mask (DI) to 00000000 00000001b
  2132.     Shl DI, CL       ;DI holds the mask, shift it CL times
  2133.     And DI, DX       ;AND the mask and the target integer
  2134.     Jz  AllDone      ;if zero, the bit WAS clear: return 0 in AX
  2135.     Dec AX           ;if not, we need to return a -1 in AX
  2136. AllDone:
  2137.     Ret
  2138. GetBit ENDP
  2139.     END
  2140. ;------------------------- END ASM CODE -----------------------------
  2141.  
  2142. What follows is a POSTIT of the OBJ file for the assembly language
  2143. code listed above. To retreive the OBJ file in a form you can use, save
  2144. this message, load it into QB, delete everything except what falls
  2145. between the lines: "*********".  Then press F5 to run the POSTIT code.
  2146.  
  2147. '*******************  START POSTIT CODE ************************
  2148.  
  2149. '** Save this script to a file, edit out all of the non-QB related
  2150. '** text and execute it in a QB environment to retrieve BITS.OBJ
  2151. CLS:?STRING$(50,177):?"Creating: BITS.OBJ with PostIt! v2.9f"
  2152. DEFINT A-Z:FOR A=0 TO 6:P(A)=2^A:NEXT:OPEN "B",1,"BITS.OBJ"
  2153. T$="abcdefghijklmnopqrstuvwxyz":T$=T$+UCASE$(T$)+"0123456789()"
  2154. G"aAbaumMoCj2B5fMBCrgBCjwA0nNlHnxBBA5iaaGbeDKupvfujiusun1xuvewura
  2155. G"rbrvqem0tevubFruqufK1yEaaiLeaduqahJ5baGeaayabb4GMeaGa)lWxqEbaae
  2156. G"GbtvevcLevaaaagCurujusuPcaaGjIeaaaIgq0G2eabaaavTi7xTOxkS4bl6Lbl
  2157. G"EXIEHWIp8Baam95dQpa0rWchVob3F9ih)vxkBaavTi7xndWl6fclEXIEzWIp8Ba
  2158. G"am95JOpDbG0xDPmbaOSIcaaa0b"
  2159. N=208:K=255:IF LEN(C$)<>278 THEN ?"Incomplete script file!":BEEP:END
  2160. FOR A=1 TO N:IF L=0 THEN GOSUB G:L=6:LOCATE 1:?STRING$((51&*A)\N,8)
  2161. W=T\P(6-L):GOSUB G:W=W OR T*P(L):L=L-2:B$=CHR$(W AND K):PUT 1,,B$:NEXT
  2162. ?:IF C<>166 THEN ?"Bad checksum!":BEEP:END ELSE ?"Success!":END
  2163. G:I=I+1:T=INSTR(T$,MID$(C$,I,1))-1:C=(C+T)*2:C=C\256+(C AND 255):RETURN
  2164. SUB G(A$):SHARED C$:C$=C$+LEFT$(A$,63):END SUB
  2165.  
  2166.  
  2167.  
  2168.  
  2169. ' From:  JOHN WOODGATE             Sent: 10-23-93 15:04
  2170. '   To:  ALL                       Rcvd: 10-27-93 08:30
  2171. '   Re:  VGA FADEOUT ROUTINE
  2172. '
  2173. 'Hello All!
  2174. '
  2175. 'I've recently written VGA Fade In/Out routines in QB and thought I'd
  2176. 'share them with ya...
  2177.  
  2178. DEFINT A-Z
  2179.  
  2180. DECLARE SUB VGAFadeOut ()
  2181. DECLARE SUB VGAFadeIn ()
  2182. DECLARE SUB ScreenOut ()
  2183. DECLARE SUB ScreenIn ()
  2184.  
  2185. DIM SHARED Pal&(0 TO 15)
  2186.  
  2187. SCREEN 12  ' VGA Required
  2188. X = 1: Y = 20
  2189. FOR a = 0 TO 7
  2190.  LINE (X, Y)-(X + 50, Y + 70), a, BF
  2191.  X = X + 65
  2192. NEXT a
  2193.  
  2194. X = 1: Y = 120
  2195. FOR a = 8 TO 15
  2196.  LINE (X, Y)-(X + 50, Y + 70), a, BF
  2197.  X = X + 65
  2198. NEXT a
  2199. LOCATE 15, 20: PRINT "You can set all the colors to black, Draw Somthing"
  2200. SLEEP 2
  2201. CALL ScreenOut
  2202. LOCATE 15, 20: PRINT "and then set the colors back to normal. "
  2203. SLEEP 2
  2204. CALL ScreenIn
  2205.  
  2206. SLEEP 4
  2207.  
  2208. LOCATE 15, 20: PRINT "You can also fade out the screen, draw somthing "
  2209. SLEEP 2
  2210. CALL VGAFadeOut
  2211. LOCATE 15, 20: PRINT "And then fade back in "
  2212. SLEEP 2
  2213. CALL VGAFadeIn
  2214. SLEEP 3
  2215. SCREEN 0: PRINT "Isn't BASIC Neat......."
  2216.  
  2217. '
  2218.  
  2219.  
  2220. SUB ScreenIn
  2221.  
  2222. PALETTE
  2223. END SUB
  2224.  
  2225. SUB ScreenOut
  2226.  
  2227. PALETTE USING Pal&(0)
  2228. END SUB
  2229.  
  2230. SUB VGAFadeIn
  2231.  
  2232. FOR a = 1 TO 63
  2233.   IF a <= 43 THEN
  2234.    clr& = 65536 * 0 + 256 * 0 + a
  2235.    PALETTE 4, clr&
  2236.    clr& = 65536 * a + 256 * 0 + 0
  2237.    PALETTE 1, clr&
  2238.    clr& = 65536 * 0 + 256 * a + 0
  2239.    PALETTE 2, clr&
  2240.    clr& = 65536 * a + 256 * a + a
  2241.    PALETTE 7, clr&
  2242.    clr& = 65536 * a + 256 * a + 0
  2243.    PALETTE 3, clr&
  2244.    clr& = 65536 * a + 256 * 0 + a
  2245.    PALETTE 5, clr&
  2246.   END IF
  2247.   IF a <= 21 THEN
  2248.    clr& = 65536 * a + 256 * a + a
  2249.    PALETTE 8, clr&
  2250.   END IF
  2251.   IF a <= 41 THEN
  2252.    IF a <= 20 THEN
  2253.     clr& = 65536 * a + 256 * a + a
  2254.     PALETTE 0, clr&
  2255.    ELSE
  2256.     clr& = 65536 * 20 + 256 * 20 + a
  2257.  
  2258.     PALETTE 6, clr&
  2259.    END IF
  2260.   END IF
  2261.  
  2262.   clr& = 65536 * a + 256 * 0 + a
  2263.   PALETTE 13, clr&
  2264.   clr& = 65536 * a + 256 * a + 0
  2265.   PALETTE 11, clr&
  2266.   clr& = 65536 * 0 + 256 * a + a
  2267.   PALETTE 14, clr&
  2268.   clr& = 65536 * a + 256 * a + a
  2269.   PALETTE 15, clr&
  2270.   clr& = 65536 * 0 + 256 * 0 + a
  2271.   PALETTE 12, clr&
  2272.   clr& = 65536 * 0 + 256 * a + 0
  2273.   PALETTE 10, clr&
  2274.   clr& = 65536 * a + 256 * 0 + 0
  2275.   PALETTE 9, clr&
  2276. NEXT a
  2277.  
  2278.  
  2279. END SUB
  2280.  
  2281. SUB VGAFadeOut
  2282.  
  2283. FOR a = 63 TO 1 STEP -1
  2284.   IF a <= 43 THEN
  2285.    clr& = 65536 * 0 + 256 * 0 + a
  2286.    PALETTE 4, clr&
  2287.    clr& = 65536 * a + 256 * 0 + 0
  2288.    PALETTE 1, clr&
  2289.    clr& = 65536 * 0 + 256 * a + 0
  2290.    PALETTE 2, clr&
  2291.    clr& = 65536 * a + 256 * a + a
  2292.    PALETTE 7, clr&
  2293.    clr& = 65536 * a + 256 * a + 0
  2294.    PALETTE 3, clr&
  2295.    clr& = 65536 * a + 256 * 0 + a
  2296.    PALETTE 5, clr&
  2297.   END IF
  2298.   IF a <= 21 THEN
  2299.    clr& = 65536 * a + 256 * a + a
  2300.    PALETTE 8, clr&
  2301.   END IF
  2302.   IF a <= 41 THEN
  2303.    IF a <= 20 THEN
  2304.     clr& = 65536 * a + 256 * a + a
  2305.     PALETTE 6, clr&
  2306.    ELSE
  2307.     clr& = 65536 * 20 + 256 * 20 + a
  2308.     PALETTE 6, clr&
  2309.    END IF
  2310.   END IF
  2311.   clr& = 65536 * a + 256 * 0 + a
  2312.   PALETTE 13, clr&
  2313.   clr& = 65536 * a + 256 * a + 0
  2314.   PALETTE 11, clr&
  2315.   clr& = 65536 * 0 + 256 * a + a
  2316.   PALETTE 14, clr&
  2317.   clr& = 65536 * a + 256 * a + a
  2318.   PALETTE 15, clr&
  2319.   clr& = 65536 * 0 + 256 * 0 + a
  2320.   PALETTE 12, clr&
  2321.   clr& = 65536 * 0 + 256 * a + 0
  2322.   PALETTE 10, clr&
  2323.   clr& = 65536 * a + 256 * 0 + 0
  2324.   PALETTE 9, clr&
  2325. NEXT a
  2326.  
  2327. END SUB
  2328.  
  2329.  
  2330.  
  2331. ' From:  JOHN WOODGATE             Sent: 10-23-93 15:04
  2332. '   To:  PAT SARNOWSKI             Rcvd: -NO-
  2333. '   Re:  BLOAD/BSAVE VGA
  2334. '
  2335. 'I'm not sure if this is exactly what you want, but here goes...
  2336.   
  2337. DEFINT A-Z
  2338.  
  2339. DECLARE FUNCTION VidMem% ()
  2340. DECLARE SUB EgaBSave (FileName$)
  2341. DECLARE SUB EgaBLoad (FileName$)
  2342. DECLARE SUB VGABSave (FileName$)
  2343. DECLARE SUB VGABLoad (FileName$)
  2344. DECLARE FUNCTION Monitor% (Segment)
  2345.  
  2346.  
  2347. TYPE RegType
  2348.   ax    AS INTEGER
  2349.   bx    AS INTEGER
  2350.   cx    AS INTEGER
  2351.   dx    AS INTEGER
  2352.   bp    AS INTEGER
  2353.   si    AS INTEGER
  2354.   di   AS INTEGER
  2355.   flags AS INTEGER
  2356. END TYPE
  2357.  
  2358. DIM SHARED InRegs AS RegType, OutRegs AS RegType
  2359. DIM SHARED Video%
  2360.  
  2361. SUB EgaBLoad (FileName$) STATIC
  2362.  
  2363. ' Loads a EGA (640x350) screen from disk
  2364. DEF SEG = &HA000
  2365. OUT &H3C4, 2: OUT &H3C5, 1
  2366. BLOAD FileName$ + ".E01", 0
  2367. OUT &H3C4, 2: OUT &H3C5, 2
  2368. BLOAD FileName$ + ".E02", 0
  2369. OUT &H3C4, 2: OUT &H3C5, 4
  2370. BLOAD FileName$ + ".E03", 0
  2371. OUT &H3C4, 2: OUT &H3C5, 8
  2372. BLOAD FileName$ + ".E04", 0
  2373. OUT &H3C4, 2: OUT &H3C5, 15
  2374. DEF SEG
  2375. END SUB
  2376.  
  2377. SUB EgaBSave (FileName$) STATIC
  2378.  
  2379.  
  2380. ' Saves a EGA (640x350) screen to disk
  2381. DEF SEG = &HA000
  2382. Size& = 28000
  2383. OUT &H3CE, 4: OUT &H3CF, 0
  2384. BSAVE FileName$ + ".E01", 0, Size&
  2385. OUT &H3CE, 4: OUT &H3CF, 1
  2386. BSAVE FileName$ + ".E02", 0, Size&
  2387. OUT &H3CE, 4: OUT &H3CF, 2
  2388. BSAVE FileName$ + ".E03", 0, Size&
  2389. OUT &H3CE, 4: OUT &H3CF, 3
  2390. BSAVE FileName$ + ".E04", 0, Size&
  2391. OUT &H3CE, 4: OUT &H3CF, 0
  2392. DEF SEG
  2393. END SUB
  2394.  
  2395. FUNCTION Monitor% (Segment) STATIC
  2396.  
  2397. DEF SEG = 0              'first see if it's color or mono
  2398. Segment = &HB800         'assume color
  2399. IF EEK(&H463) = &HB4 THEN
  2400.  
  2401.   Segment = &HB000       'assign the monochrome segment
  2402.   Status = INP(&H3BA)    'get the current video status
  2403.   FOR X = 1 TO 30000     'test for a Hercules 30000 times
  2404.     IF INP(&H3BA) <> Status THEN
  2405.       Monitor% = 2       'the port changed, it's a Herc
  2406.       EXIT FUNCTION      'all done
  2407.     END IF
  2408.   NEXT
  2409.   Monitor% = 1           'it's a plain monochrome
  2410.  
  2411. ELSE                     'it's some sort of color monitor
  2412.  
  2413.   InRegs.ax = &H1A00     'first test for VGA
  2414.   CALL INTERRUPT(&H10, InRegs, OutRegs)
  2415.   IF (OutRegs.ax AND &HFF) = &H1A THEN
  2416.     Monitor% = 5         'it's a VGA
  2417.     EXIT FUNCTION        'all done
  2418.   END IF
  2419.  
  2420.   InRegs.ax = &H1200     'now test for EGA  
  2421.   InRegs.bx = &H10   
  2422.   CALL INTERRUPT(&H10, InRegs, OutRegs)
  2423.   IF (OutRegs.bx AND &HFF) = &H10 THEN
  2424.     Monitor% = 3         'if BL is still &H10 it's a CGA
  2425.   ELSE
  2426.     Monitor% = 4         'otherwise it's an EGA
  2427.   END IF
  2428.  
  2429. END IF
  2430. END FUNCTION
  2431.  
  2432. SUB VGABLoad (FileName$)
  2433.  
  2434. ' Loads a VGA (640x480) screen from disk
  2435. DEF SEG = &HA000
  2436. OUT &H3C4, 2: OUT &H3C5, 1
  2437. BLOAD FileName$ + ".V01", 0
  2438. OUT &H3C4, 2: OUT &H3C5, 2
  2439. BLOAD FileName$ + ".V02", 0
  2440. OUT &H3C4, 2: OUT &H3C5, 4
  2441. BLOAD FileName$ + ".V03", 0
  2442. OUT &H3C4, 2: OUT &H3C5, 8
  2443. BLOAD FileName$ + ".V04", 0
  2444. OUT &H3C4, 2: OUT &H3C5, 15
  2445. DEF SEG
  2446. END SUB
  2447.  
  2448. SUB VGABSave (FileName$)
  2449.  
  2450. ' Saves a VGA (640x480) screen to disk
  2451. DEF SEG = &HA000
  2452. Size& = 38400
  2453. OUT &H3CE, 4: OUT &H3CF, 0
  2454. BSAVE FileName$ + ".V01", 0, Size&
  2455. OUT &H3CE, 4: OUT &H3CF, 1
  2456. BSAVE FileName$ + ".V02", 0, Size&
  2457. OUT &H3CE, 4: OUT &H3CF, 2
  2458. BSAVE FileName$ + ".V03", 0, Size&
  2459. OUT &H3CE, 4: OUT &H3CF, 3
  2460. BSAVE FileName$ + ".V04", 0, Size&
  2461. OUT &H3CE, 4: OUT &H3CF, 0
  2462. DEF SEG
  2463. END SUB
  2464.  
  2465. FUNCTION VidMem%
  2466.  
  2467. ' Let's you know how much Video RAM is installed
  2468. ' VGA/EGA Only
  2469. DEF SEG = 0
  2470. byte = PEEK(&H487)
  2471. byte = byte AND 96
  2472. byte = byte \ 32
  2473. byte = (byte + 1) * 64
  2474. VidMem% = byte
  2475. END FUNCTION
  2476.  
  2477.  
  2478.  
  2479.  
  2480.  
  2481.  
  2482. ' From:  STEVE DEMO                Sent: 10-24-93 11:04
  2483. '   To:  CHRIS MENNIE              Rcvd: -NO-
  2484. '   Re:  (R)FADING OUT
  2485. '
  2486. ' CM> Does anybody have a routine for fading a VGA screen?
  2487.  
  2488. 'Yep,
  2489.  
  2490. DEFINT A-Z
  2491. DECLARE SUB Fade2Black (loops)
  2492. RANDOMIZE TIMER
  2493. SCREEN 13
  2494. FOR x = 1 TO 320
  2495.  J = INT(RND * 256) + 1
  2496.  LINE (x, 1)-(x, 200), J
  2497. NEXT
  2498. FOR loops = 1 TO 100
  2499.     Y = INT(RND * 190) + 1
  2500.     x = INT(RND * 310) + 1
  2501.     Size = INT(RND * 20) + 1
  2502.     Clur = INT(RND * 150) + 31
  2503.     CIRCLE (x, Y), Size, Clur
  2504.     PAINT (x, Y), Clur, Clur
  2505. NEXT
  2506. Fade2Black 600
  2507. SLEEP 1
  2508. PALETTE
  2509.  
  2510. SUB Fade2Black (loops)
  2511.   DEF SEG = &HA000
  2512.   OUT &H3C7, 0
  2513.   OUT &H3C8, 0
  2514.       FOR CLRS = 1 TO 768
  2515.         'Adjust this for Machine Speed It's old fasion
  2516.         'but better than clock ticks that look like Stuttering.
  2517.         '//////////////////////////
  2518.         FOR x = 1 TO loops: NEXT x
  2519.         OUT &H3C9, 0
  2520.       NEXT CLRS
  2521.   DEF SEG
  2522. END SUB
  2523.  
  2524.  
  2525.  
  2526.  
  2527. Msg #:  2114                      QUIKBAS Subboard
  2528.  From:  MIKE AUDLEMAN             Sent: 06-02-94 19:07
  2529.    To:  ALL                       Rcvd: -NO-
  2530.    Re:  QBFAQ 1
  2531.  
  2532.                      The psudo, almost real, semi-
  2533.                    ╔═══╗ ╔══╕ ╔══╕ ╥ ╔═══╗ ╥ ╔═══╗ ╥
  2534.                    ║   ║ ╠═╡  ╠═╡  ║ ║     ║ ╠═══╣ ║
  2535.                    ║   ║ ║    ║    ║ ║     ║ ║   ║ ║
  2536.                    ╚═══╝ ╨    ╨    ╨ ╚═══╝ ╨ ╨   ╨ ╚══╛
  2537.                                 looking
  2538.          ╔═══╗  ╥   ╥ ╥ ╔═══╗ ╥  /   ╔═══╗ ╔═══╗ ╔═══╕ ╥ ╔═══╗
  2539.          ║   ║  ║   ║ ║ ║     ║ /    ╠═══╣ ╠═══╣ ╚═══╗ ║ ║
  2540.          ║  \║  ║   ║ ║ ║     ║/\    ║   ║ ║   ║     ║ ║ ║
  2541.          ╚═══╝\ ╚═══╝ ╨ ╚═══╝ ╨  \   ╚═══╝ ╨   ╨ ╘═══╝ ╨ ╚═══╝
  2542.  
  2543.                            ╔══╕ ╔═══╗ ╔═══╗
  2544.                            ╠═╡  ╠═══╣ ║   ║
  2545.                            ║    ║   ║ ║  \║
  2546.                            ╨   .╨   ╨.╚═══╝\.
  2547.                        Frequently Asked Questions
  2548.                       Version 1.0 - Release 6/1/94
  2549.                   Written and Created by Mike Audleman
  2550.                   Copyright (C) 1994 by Mike Audleman
  2551.  
  2552.  Please distribute freely but UNMODIFIED.  If you have contributions,
  2553.  you may send them to MIKE AUDLEMAN at FIDO address 1:154/288 or on the
  2554.  Quick_Basic FIDO echo.  Please send them as ASCII text only, no
  2555.  formatted doccuments (WP, W4WIN etc.).  This is not an OFFICIAL
  2556.  document and as such all information is provided ASIS and no warrenties
  2557.  are implied as to the acuracy of anything included here.  The questions
  2558.  and answers here are take from the Quick_Basic echo that I read weekly
  2559.  and reflect general questions that seem to appear on a regular basis. I
  2560.  write this in an effort to reduce the load on the net and plan to
  2561.  release new or updated versions on a monthly basis unless the load
  2562.  seems such that another interval is warrented.
  2563.  
  2564.  Since this is NOT a CODE SNIPPIT publication, code here will be limited
  2565.  severely.  Only enough code to present information will be included. At
  2566.  this time, I do not know if there is anyone maintaining a snippit file,
  2567.  but if someone is, please forward the name and fido address that it can
  2568.  be freq'd from and I will include the info on it here.
  2569.  
  2570.  This publication is not connected in any way to any commercial
  2571.  concern, mine or otherwise and is free to all.  No information
  2572.  contained herin is to be considered as an advertisment for any product,
  2573.  consider it as INFORMATION only.
  2574.  
  2575.  One last note, I do not own any version of PDS so I am unable to test
  2576.  ANY of the information with regard to that package.  I do have QB45 and
  2577.  have tested MOST but NOT all on it.  Additionally, much of this
  2578.  information will not be compatible to QBasic provided with MSDOS 5.0
  2579.  and above since it is missing many of the features of the full compiler
  2580.  version.
  2581.  
  2582.                                                  Thank you.
  2583.                                                  Mike Audleman
  2584.                                                  FIDO: 1:154/280
  2585.  
  2586.  
  2587.                                  INDEX
  2588.     "How do I get arguments from the command line?"
  2589.     "How do I make QB45 stop converting COMMAND$ to uppercase?"
  2590.     "How do I make QuickBasic exit with an ErrorLevel?"
  2591.     "How do I load QB with two LIBs?"
  2592.     "Are there any good books on QuickBasic?"
  2593.     "How do I get a number from a string into an Integer?"
  2594.     "How do I remove spaces from a string?"
  2595.     "What are 'String Descriptors'?"
  2596.     "What is the difference between QBASIC and QuickBasic?"
  2597.     "How do I convert from a HEX number to DECIMAL or DECIMAL to HEX?"
  2598.     "How do I make QuickBasic reboot the system?"
  2599.     "Could anybody show me how `INKEY$' works please?"
  2600.     "How do you do ARCSIN and ARCCOS?"
  2601.     "How do the AND, OR, and XOR work?"
  2602.     "How do I seperate command line arguments?"
  2603.  
  2604.  
  2605.  
  2606. *>  "How do I get arguments from the command line?"
  2607.  
  2608.     Use the COMMAND$ function in QB, QB45 and PDS thus:
  2609.  
  2610.             Commandline$=COMMAND$
  2611.  
  2612.     One caviat here is that QB and QB45 converts the command line to
  2613.     UPPERCASE only.  I am not sure about PDS on the uppercase.
  2614.  
  2615. *>  "How do I make QB45 stop converting COMMAND$ to uppercase?"
  2616.  
  2617.     One method is to obtain a addon lib that provides direct access to
  2618.     the PSP and the unconverted command line.  The LIB I released in
  2619.     5/94 on the Quick_Basic net provides this and it is free.  This
  2620.     method provides the same capability in the design environment as
  2621.     well as when the file is compiled, the patch mentioned next does
  2622.     not.  The second method is to apply a patch to one of your QB45
  2623.     files. The following patch for QB45 will prevent QB from forcing the
  2624.     command line to uppercase.  Once you make this patch, you will have
  2625.     to use UCASE$(COMMAND$) to retreive an uppercase only string.
  2626.  
  2627.     The following steps will extract the OSCMD.OBJ file from your
  2628.     BCOM45.LIB, modify it and then replace it with the modified version.
  2629.     As always, MAKE A BACKUP OF BCOM45.LIB FIRST!  One note, this will
  2630.     not affect the design environment, it will still force to uppercase.
  2631.     When the BAS file is compiled and linked, it will return the command
  2632.     line as typed.  I still have not found the correct patch to QB.EXE.
  2633.  
  2634.     First, enter the following command:
  2635.         LIB BCOM45 *OSCMD
  2636.  
  2637.     Then run the following basic program
  2638.         Search$ = ""
  2639.         FOR X% = 1 TO 10
  2640.                 READ Y%
  2641.                 Search$ = Search$ + CHR$(Y%)
  2642.         NEXT X%
  2643.         Replace$ = CHR$(235) + CHR$(8) + STRING$(8, 144)
  2644.         PRINT "OSCMD.OBJ ";
  2645.         OPEN "OSCMD.OBJ" FOR BINARY AS 1
  2646.         X$ = SPACE$(LOF(1))
  2647.         GET 1, , X$
  2648.         X% = INSTR(X$, Search$)
  2649.         IF X% = 0 THEN PRINT "Not Modified.": CLOSE : END
  2650.         MID$(X$, X%) = Replace$
  2651.         PUT 1, 1, X$
  2652.         CLOSE : PRINT "Modified.": END
  2653.         DATA 60,97,114,6,60,122,119,2,52,32
  2654.  
  2655.     Now enter the following command:
  2656.         LIB BCOM45 -OSCMD +OSCMD,,BCOM45
  2657.  
  2658.     You should now have a modified BCOM45.LIB.
  2659.  
  2660. *>  "How do I make QuickBasic exit with an ErrorLevel?"
  2661.  
  2662.     Add the following declare statement at the beginning of your
  2663.     program:
  2664.  
  2665.         DECLARE SUB ExitWithErrLvl ALIAS "_exit" (BYVAL ERRORLEVEL%)
  2666.  
  2667.     Then to exit with an Error level contained in a variable:
  2668.         ExitWithErrorLvl Oops%
  2669.  
  2670.     WARNING: DO NOT USE THIS WHILE IN THE DEVELOPEMENT ENVIRONMENT IT
  2671.     WILL EXIT TO DOS WITHOUT PROMPTING FOR A SAVE.  IT HAS ON OCCASION
  2672.     LOCKED UP MY XT AND MY 386 WHEN USED IN THE ENVIRONMENT.
  2673.  
  2674. *>  "How do I load QB with two LIBs?"
  2675.  
  2676.     You can't.  You must combine the two LIBs into one and load that one
  2677.     instead.  This is a common situation that there are routines in the
  2678.     stock QB.LIB you need as well as an addon at the same time.  Here is
  2679.     how you combine two LIBs and generate a third to use.
  2680.  
  2681.       This combines QB.LIB and FOO.LIB into MYLIB.LIB generating a
  2682.       MYLIB.CAT catalog file:
  2683.  
  2684.             LIB QB.lib +FOO.LIB,MYLIB.CAT,MYLIB.CAT
  2685.  
  2686.     Now we must take the combined MYLIB.LIB and generate MYLIB.QLB:
  2687.  
  2688.             LINK /q MYLIB.LIB,MYLIB.QLB,nul,BQLB45 ;
  2689.  
  2690.     Note that the above lines assume that the current directory is your
  2691.     directory that contains QB45 and all the files, if not you must
  2692.     provide complete paths to all files not in the current directory.
  2693.  
  2694. *>  "Are there any good books on QuickBasic?"
  2695.  
  2696.     Yes,  probably the most recomended is:
  2697.       "MicroSoft QuickBasic Bible"
  2698.       by the Waite Group
  2699.       MicroSoft Press ISBN: 1-55615-262-0
  2700.       * Good examples on EVERY command
  2701.  
  2702.     Another good book that deals with INTERRUPT programming:
  2703.  
  2704.      "MD-DOS 5 Programming"
  2705.      by Peter G. Aitken
  2706.      MicroSoft Press ISBN: 1-55615-471-2
  2707.      * Sample code in QuickBasic and C for MANY interrupt calls
  2708.  
  2709. *>  "How do I get a number from a string into an Integer?"  Use:
  2710.  
  2711.         X% = VAL(TheString$)
  2712.  
  2713. *>  "How do I remove spaces from a string?"
  2714.  
  2715.     To remove spaces at the beginning of a string use
  2716.  
  2717.        X$ = LTRIM$(TheString$)
  2718.  
  2719.     To remove spaces at the end of a string use
  2720.  
  2721.        X$ = RTRIM$(TheString$)
  2722.  
  2723.     To remove at both beginning and end use
  2724.        X$ = LTRIM$(RTRIM$(TheString$))
  2725.  
  2726. *>  "What are 'String Descriptors'?"
  2727.  
  2728.     Generally you will never need to know this unless you plan to write
  2729.     ASM or C routines to use with QuickBasic.  String Descriptors are
  2730.     packs of 4 bytes that contain the offset within the DGROUP that the
  2731.     actual text of the string starts at and the length of the data.  QB
  2732.     does not use ASCIIZ strings (strings that end with a CHR$(0)) so you
  2733.     must convert them in your code if you wish to use them with C in
  2734.     most cases.  The block looks like:
  2735.  
  2736.     2 bytes     Offset within DGROUP
  2737.     2 bytes     Length of string data
  2738.     Both are UNSIGNED integers (0-65535)
  2739.  
  2740. *>  "What is the difference between QBASIC and QuickBasic?"
  2741.     A lot!  Some of them are:
  2742.     QBASIC will not compile a BAS file into a EXE, QB45 does.
  2743.     QBASIC does not have a CALL INTERRUPT, QB45 does.
  2744.     QBASIC does not allow use of LIBs, QB45 does.
  2745.     QBASIC is a stripped down version of QB45 included with DOS 5.0 and
  2746.     above.
  2747.     QuickBasic must be purchased.  The retail price varies but should be
  2748.     around $65-$80 U.S..
  2749.  
  2750.     Generally, almost all BAS code will run in QBASIC. The exception is
  2751.     that if is uses INTERRUPTS or outside LIBs, it will not.  There is
  2752.     however a CALL ABSOLUTE that does allow SOME access to ASM code but
  2753.     it is not simple and the routines must be small. Generally, if you
  2754.     are an occasional programmer, QBASIC will do just fine, however, if
  2755.     you want to end up with an EXE file or do some serious programming,
  2756.     QB45, or PDS would really be the way to go. Other packages available
  2757.     are Power Basic and Visual Basic for DOS. These other two packages
  2758.     are fine too and provide some additional commands over QB45 but as
  2759.     such are not backward compatible to QB45.
  2760.  
  2761. *>  "How do I convert from a HEX number to DECIMAL or DECIMAL to HEX?"
  2762.  
  2763.     To change from a HEX string to an integer:
  2764.  
  2765.       TheString$="6B"
  2766.       X%=VAL("&H"+TheString$)
  2767.  
  2768.     To change from an integer to a HEX string:
  2769.  
  2770.       X$=HEX$(TheInteger%)
  2771.  
  2772. *>  "How do I make QuickBasic reboot the system?"
  2773.     Here is a simple code snippit to do just this:
  2774.  
  2775.     SUB WarmBoot
  2776.         DEF SEG = 0
  2777.         POKE &h473, &h12
  2778.         POKE &h472, &h34
  2779.         DEF SEG = &hFFFF
  2780.         CALL ABSOLUTE(0)
  2781.     END SUB
  2782.  
  2783.     SUB ColdBoot
  2784.         DEF SEG = &hFFFF
  2785.         CALL ABSOLUTE(0)
  2786.     END SUB
  2787.  
  2788. *>  "Could anybody show me how `INKEY$' works please?"
  2789.  
  2790.     Inkey simply checks the keyboard and then returns.  If there was a
  2791.     keypress then it is returned, if not, inkey returns a NULL string.
  2792.     There are several methods of it's use.
  2793.  
  2794.     One is a one time scan....
  2795.  
  2796.     For x=1 to 1000
  2797.            ;do your stuff
  2798.            if inkey$=chr$(27) then exit for
  2799.     next x
  2800.  
  2801.     The other is to use it to scan the keyboard in a continuous loop
  2802.     until a key is pressed....
  2803.  
  2804.     Function GetKey$
  2805.            do:X$=Inkey$:loop while X$=""
  2806.            GetKey$=X$
  2807.     End Function
  2808.  
  2809.     Here is a similar routine to accept keys and Capitolize the first
  2810.     letter of each word....
  2811.  
  2812.     Function GetKeyCap$
  2813.     Toggle%=False
  2814.     Stuff$=""
  2815.            Do
  2816.                    X$=Inkey$
  2817.                    If X$=CHR$(13) then exit do   'User Pressed ENTER
  2818.                    If Toggle% then X$=Lcase$(X$) else X$=Ucase$(X$)
  2819.                    Stuff$=Stuff$+X$
  2820.                    Toggle%=( X$<>" ") 'Is it a Space?
  2821.            Loop
  2822.  
  2823.     GetKeyCap$=Stuff$
  2824.  
  2825.     End Function
  2826.  
  2827. *>  "How do you do ARCSIN and ARCCOS?"
  2828.  
  2829.      ARCSIN and ARCCOS are "derived" functions.  You can compute them
  2830.      using the following:
  2831.  
  2832.      CONST PI=3.141593
  2833.      ARCSIN(A) = ATN(A / SQR(-A * A+1))
  2834.      ARCCOS(A) = PI / 2 - ATN(A / SQR(-A * A+1))
  2835.  
  2836.      To convert these into full blown functions:
  2837.  
  2838.      Function ARCSIN# (A#)
  2839.        ARCSIN# = ATN(A# / SQR(-A# * A#+1#))
  2840.      end Function
  2841.  
  2842.      Function ARCCOS# (A#)
  2843.        ARCCOS# = PI / 2# - ATN(A# / SQR(-A# * A#+1#))
  2844.      end Function
  2845.  
  2846. *>  "How do the AND, OR, and XOR work?"
  2847.  
  2848.     Well, AND, OR and XOR can be mathmatical or comparative functions.
  2849.  
  2850.     The math functions would be (this is BIT level):
  2851.  
  2852.       AND           OR            XOR
  2853.     -----------   -----------   -----------
  2854.     0 AND 0 = 0   0 OR 0 = 0    0 XOR 0 = 0
  2855.     1 AND 0 = 0   1 OR 0 = 1    1 XOR 0 = 1
  2856.     0 AND 1 = 0   0 OR 1 = 1    0 XOR 1 = 1
  2857.     1 AND 1 = 1   1 OR 1 = 1    1 XOR 1 = 0
  2858.  
  2859.     15=1111, 7=0111, 6=0110, 2=0010, 10=1010
  2860.     so: 15 AND 7 = 7, 6 OR 2 = 6, 10 XOR 10 = 0
  2861.  
  2862.     The comparitive functions are like this:
  2863.     AND = "This AND That"
  2864.      OR = "This OR That"
  2865.     XOR = "This OR That BUT NOT BOTH"
  2866.  
  2867.     If (5 > 1) AND (6 < 10 ) then Yep
  2868.       If 5 is larger than 1 and 6 is less than 10
  2869.  
  2870. *>  "How do I seperate command line arguments?"
  2871.  
  2872.     You can use the following routine to seperate anything in a string
  2873.     variable that is seperated by spaces:
  2874.  
  2875.     DIM SHARED arg$(20) 'Max of 20 arguments, increase/decrease for your app.
  2876.  
  2877.     'Set up string and make call:
  2878.  
  2879.     TheString$="This is a test of the EBS system."
  2880.  
  2881.     NumOfWords%=ArgSplit%(TheString$)
  2882.  
  2883.     For x%=0 to NumOfWords%
  2884.         Print arg$(x%)
  2885.     Next x%
  2886.  
  2887.     SUB ArgSplit%(cline$)
  2888.            I = 1: arg = LBOUND(arg$): inword = -1
  2889.            WHILE I <= LENGTH
  2890.                    ch$ = MID$(cline$, I, 1)
  2891.                    IF ch$ <> " " THEN
  2892.                            IF NOT inword THEN inword = -1
  2893.                            arg$(arg) = arg$(arg) + ch$
  2894.                    ELSEIF inword THEN
  2895.                            arg = arg + 1
  2896.                            inword = 0
  2897.                    END IF
  2898.                    I = I + 1
  2899.            WEND
  2900.     ArgSplit% = arg
  2901.     END SUB
  2902.  
  2903.  
  2904. END of FAQ Document
  2905.  
  2906.  
  2907.  
  2908. Msg #:  2131                      QUIKBAS Subboard
  2909.  From:  SAUL ANSBACHER            Sent: 05-26-94 20:57
  2910.    To:  KEN WITHEROW              Rcvd: -NO-
  2911.    Re:  (R)QBNEWS AND THE BCC
  2912.  
  2913.  SA> Put in that code for Interrupts in QBASIC and then most people will be
  2914.  SA> able to follow along, if you don't ahve it, I can send you two
  2915.  SA> different ways.  I also have code for interrupts in GWBASIC, that is if
  2916.  SA> you want a humour coloum<g>...
  2917.  
  2918.  KW> Somewhere I've got the QBasic one, but not GW. Hmm... I do know how to
  2919.  KW> interface ASM language to GW (hehehe, hat's really scary).
  2920.  
  2921. Well try this: Weird....
  2922.  
  2923.  
  2924. 100 ' MEESCALL.BAS  demonstrates how to call mouse functions in GW-BASIC
  2925. 110 '
  2926. 120 '   Author:     Christy Gemmell
  2927. 130 '   Date:       15/9/1991
  2928. 140 '
  2929. 150 ' Load general-purpose interrupt service interface.
  2930. 160 '
  2931. 170 DEFINT A-Z: CLS: PRINT: KEY OFF
  2932. 180 DIM REG.IN(7), REG.OUT(7)
  2933. 190 AX = 0: BX = 1: CX = 2: DX = 3: SI = 4: DI = 5: DS = 6: ES = 7
  2934. 200 SYSINT$ = SPACE$(116)
  2935. 210 FOR X = 1 TO 116
  2936. 220     READ A$: MID$(SYSINT$, X, 1) = CHR$(VAL("&H" + A$))
  2937. 230 NEXT
  2938. 240 '
  2939. 250 '  Test out some mouse functions with it.
  2940. 260 '
  2941. 270 INT.NO = &H33   ' Microsoft Mouse driver interrupt number
  2942. 280 '
  2943. 290 '  Reset Mouse and get status
  2944. 300 '
  2945. 310 REG.IN(AX) = 0: GOSUB 770
  2946. 320 IF REG.OUT(AX) = 0 THEN PRINT "Mouse not installed!": BEEP: STOP
  2947. 330 PRINT "A"; REG.OUT(BX); "- button mouse is available"
  2948. 340 PRINT "Turning on the Mouse pointer"
  2949. 350 PRINT: PRINT "Press the <Esc> key to quit"
  2950. 360 '
  2951. 370 '  Show Mouse pointer
  2952. 380 '
  2953. 390 REG.IN(AX) = 1: GOSUB 770
  2954. 400 '
  2955. 410 ' Main control loop
  2956. 420 '
  2957. 430 IF INKEY$ = CHR$(27) THEN GOTO 600
  2958. 440 '
  2959. 450 '  Get Mouse pointer and button status
  2960. 460 '
  2961. 470    REG.IN(AX) = 3: GOSUB 770
  2962. 480    LOCATE 10, 1: PRINT "X ="; REG.OUT(CX); " "
  2963. 490    LOCATE 11, 1: PRINT "Y ="; REG.OUT(DX); " "
  2964. 500    LOCATE 13, 1
  2965. 510    IF REG.OUT(BX) = 1 THEN PRINT "Left Button Down" ELSE PRINT SPACE$(20)
  2966. 520    LOCATE 14, 1
  2967. 530    IF REG.OUT(BX) = 3 THEN PRINT "Centre Button Down" ELSE PRINT SPACE$(20)
  2968. 540    LOCATE 15, 1
  2969. 550    IF REG.OUT(BX) = 2 THEN PRINT "Right Button Down" ELSE PRINT SPACE$(20)
  2970. 560 GOTO 430
  2971. 570 '
  2972. 580 '  Hide Mouse pointer
  2973. 590 '
  2974. 600 REG.IN(AX) = 2: GOSUB 770
  2975. 610 END
  2976. 620 '
  2977. 630 '  Machine-language opcodes
  2978. 640 '
  2979. 650 DATA 55, 8B, EC, 8B, 5E, 0A, 8B, 07, 8B, 5E, 06, 8B, CB
  2980. 660 DATA 8B, 5E, 08, 06, 1E, E8, 05, 00, 00, 00, CD, 00, C3
  2981. 670 DATA 5D, 88, 46, 03, 89, 4E, 00, 8B, 4F, 04, 8B, 57, 06
  2982. 680 DATA 8B, 77, 08, 8B, 7F, 0A, 8B, 47, 0E, 3D, FF, FF, 74
  2983. 690 DATA 02, 8E, C0, 8B, 47, 0C, 3D, FF, FF, 74, 02, 8E, D8
  2984. 700 DATA 36, 8B, 07, 36, 8B, 5F, 02, E8, CC, FF, 53, 8B, 5E
  2985. 710 DATA 00, 36, 89, 07, 36, 8F, 47, 02, 8C, D8, 36, 89, 47
  2986. 720 DATA 0C, 1F, 8C, C0, 89, 47, 0E, 07, 89, 4F, 04, 89, 57
  2987. 730 DATA 06, 89, 77, 08, 89, 7F, 0A, 5D, CA, 06, 00, 00
  2988. 740 '
  2989. 750 '  Call machine-language routine
  2990. 760 '
  2991. 770 X = VARPTR(SYSINT$)
  2992. 780 SYSINT! = PEEK(X + 1) + 256 * PEEK(X + 2)
  2993. 790 CALL SYSINT!(INT.NO, REG.IN(0), REG.OUT(0))
  2994. 800 RETURN
  2995.  
  2996. 'BTW That assembly-language routine can be used for other things than
  2997. 'the mouse. It is actually a general-purpose program which you can use
  2998. 'to make DOS (INT 21h) and BIOS (INT 10h, INT 16h etc) interrupt calls.
  2999. 'In effect a GW-BASIC version of QuickBASIC's CALL INTERRUPT.
  3000.  
  3001.  
  3002.  
  3003.